Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library name with dune #21

Open
ghilesZ opened this issue Jan 29, 2021 · 2 comments
Open

library name with dune #21

ghilesZ opened this issue Jan 29, 2021 · 2 comments

Comments

@ghilesZ
Copy link

ghilesZ commented Jan 29, 2021

I tried to compile a small example using dune and weirdly, adding (libraries ocamlsdl2) to my stanza produces the error:

Error: Library "ocamlsdl2" not found.
Hint: try:
  dune external-lib-deps --missing a.exe

Eventhough it is installed, as shown from the command:

$ opam list | grep ocamlsdl
ocamlsdl                0.9.1       Interface between OCaml and SDL
ocamlsdl2               0.04        Interface to the SDL2 library

However, putting (libraries sdl2) in my dune file works fine. Is this a normal documented behaviour? Is this a bug of dune? Or a bug of OCamlSDL2?

@fccm
Copy link
Owner

fccm commented Jan 30, 2021

Yes indeed, these bindings are installed in ~/.opam/$VERSION/lib/sdl2.
The command ocamlfind query sdl2 should confirm that (if the installation inside opam proceeded correctly.)

Should I document this point in the README file or in the INSTALL file?
Or maybe I should merge INSTALL inside a paragraph of README?

@ghilesZ
Copy link
Author

ghilesZ commented Jan 30, 2021

Personally, I usually assume that everything is in the README. Just so you know, the fact that the opam package and location inside ~/.opam/$VERSION/lib/sdl2 do not have the same name messes with dune's external-lib-deps feature:

When ocamlsdl2 is not installed, having (libraries sdl2) in the dune file and doing dune external-lib-deps --missing @@default results in dune outputing:

The following libraries are missing in the default context:
- sdl2
Hint: try:
  opam install sdl2

and then:

opam install sdl2
[ERROR] No package named sdl2 found.

Which is a bit confusing.
Symetrically, when ocamlsdl2 is installed, putting (libraries ocamlsdl2) in the dune file produces:

The following libraries are missing in the default context:
- ocamlsdl2
Hint: try:
  opam install ocamlsdl2

and then

 opam install ocamlsdl2
[NOTE] Package ocamlsdl2 is already installed (current version is 0.04).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants