fccm / OCamlSDL2

OCaml interface to SDL 2.0 (for Linux, Windows, MacOS, and ChromeBook)
Other
51 stars 10 forks source link

library name with dune #21

Open ghilesZ opened 3 years ago

ghilesZ commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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).