Dune file dependencies with dots

I have downloaded janestreets async repo and run make

Dune throws errors for dune file listed dependencies of this format:

core.command_unix core_kernel.core core.filename_unix)

as seen in async/dune at master · janestreet/async · GitHub

How do we install these dependencies?

When you try to build the file you get:

❯ dune build ./example/hello.exe
File "example/dune", line 7, characters 53-71:
7 |  (libraries async core.command_unix core_kernel.core core.filename_unix)
                                                         ^^^^^^^^^^^^^^^^^^
Error: Library "core.filename_unix" not found.
Hint: try:
  dune external-lib-deps --missing ./example/hello.exe

~/Github/async main ⇡2 !4                                                                                                          3.0.1
❯ dune external-lib-deps --missing ./example/hello.exe
Error: The following libraries are missing in the default context:
- core.command_unix
- core.filename_unix
- core_kernel.core
Hint: try:
  opam install core core_kernel

Thanks

Have you tried the hint?

Cheers,
Nicolas

Keep in mind that the master branches of janestreet packages, if things have not changed, require a separate “bleeding edge” opam repository: GitHub - janestreet/opam-repository: Opam repository for the development version of Jane Street packages

1 Like

@nojb yes. Just keeps going in circles saying its not installed. I ommitted that from the output. Thanks for the tip just the same.

@mseri Thank you. I have been able to use bleeding edge yet. Some kind of issue building on m1 macos.

Still, is core.filename_unix a legal way to add a dep in dune?

Also curious about why janestreet doesnt use dune2.0…

Yes, that’s the correct syntax for it. In this case, core is the opam package and filename_unix is the actual name of the library.

The dune files you see on Jane Street’s open-source packages are actually generated from internal jenga build specification files, which are similar but not quite the same. Jane Street is in the process of transitioning from jenga to dune, but the dune files you see aren’t hand-written at the moment. I guess the files specify the 1.10 version of the dune lang because they don’t need any new features yet.

Is it possible your environment is out of sync with opam? Try eval $(opam env) at the command line before running the rest of the commands (opam install, dune build).

1 Like