I’m confused about what’s happening and how to fix it. I’m on macOS and the Unix
module works in utop
but fails in dune build
, dune exec
, and possibly other commands. It is ocaml-platform extension in vscode sees the module (shows the signature when I hover the symbol, and allows to jump to the unix.mli
file whose path is in my one and only switch).
I have reproduced the problem in a simple app named hellocaml
with the following main.ml
:
let () =
Printf.printf "Hello, %s" (Unix.getenv "HOME");
When I run dune exec hellocaml
I get the following error
File "_none_", line 1:
Error: No implementations provided for the following modules:
Unix referenced from bin/.main.eobjs/native/dune__exe__Main.cmx
But if I launch dune utop
the same code works.
Using other standard libraries, such as Sys.getenv
, shows no issues.
The project was created with dune init project hellocaml
. The dune-project
is
(lang dune 3.2)
(name hellocaml)
(generate_opam_files true)
(package
(name hellocaml)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune))
The dune
files have not been touched.
4 posts - 2 participants