Package not found after opam install

Hi,

I am trying to install via opam a library (of which i’m the author) called geoml.
When i do opam install geoml, i get the success message:

∗ installed geoml.0.1
Done.

However, both dune and ocamlfind can not find it, for example when i do:
ocamlfind query geoml ,
I get:
ocamlfind: Package 'geoml' not found

But when i do
opam list | grep geoml
i get:
geoml 0.1 Geoml: 2D Geometry library for OCaml

Even weirder, when i inspect the directory where opam installs libraries, geoml is not present there, e.g:

ls $(opam var lib)/geoml
ls: cannot access '.opam/4.11.0/lib/geoml': No such file or directory

Finally, i’ve made some research and the closest i’ve found is this github issue, where it seems that the problem was fixed by changing the declaration of the public_name in the dune file but the links to the relevant changes are dead, and it’s not clear what was the actual mistake.

So if anyone has some idea of what’s going on, i would appreciate some inputs.

Here’s the link of the github repo: GitHub - ghilesZ/geoml: A 2d geometry library for ocaml

PS: I would have liked to put links to the .opam, dune and dune-project but new users are only allowed two links

In your opam file, your build command ("dune" "build" "-p" name "-j" jobs) has a condition {with-test}, so when you install via opam without the -t flag it doesn’t build anything, and doesn’t install anything. Your library seems to contain tests, so you should add a new line in the build instructions for running the tests, and move the condition to this new line.
Typically:

  ["dune" "build" "-p" name "-j" jobs]
  ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc}
  ["dune" "build" "@runtest" "-p" name "-j" jobs] {with-test}

Hopefully this should fix your problem.

2 Likes

Thanks for your time, it indeed solved my problem :slight_smile:

Are you able to post links formatted as code?

My advice for you is to have Dune generate the opam file for you. This way, your opam file will not have mistakes like having the {with-test} condition next to the install command.

3 Likes