Overriding a too restrictive version limit in opam on a package dependency

I’m trying to compile a library that depends on hashset (GitHub - backtracking/hashset: OCaml implementation of sets as hash tables by Jean-Christophe Filliatre). I can compile hashset manually using OCaml 5.2.0, but in opam it says it requires OCaml < 5.0.0 (opam - hashset).

In the short term, how can I tell opam to ignore this requirement? And in the long term, how do I suggest to remove the requirement? I opened an issue in the hashset repo, but I’m not seeing this requirement there, so I don’t really know what I need to change in a PR to fix this.

  1. Maybe OPAMIGNORECONSTRAINTS from opam --help?
  2. You could make a pull request with changes in this line
    opam-repository/packages/hashset/hashset.1.0.0/opam at master · ocaml/opam-repository · GitHub

The hashset 1.0.0 release from 2017 uses Array.create which is not compatible with OCaml 5:

Since then, Update to use dune and prep for publishing new version to OPAM by reubenrowe · Pull Request #1 · backtracking/hashset · GitHub has been merged (last month).
This explains why you can compile the repo by hand without problems.

For now, you can pin this development version from the master branch.
Going forward, we have to wait for a new opam-repo release containing the fix from the above PR.

1 Like
  1. Maybe OPAMIGNORECONSTRAINTS from opam --help?

Ah, thank you, that pointed me towards the correct direction. I can try
to install it using opam install hashset --ignore-constraints-on=ocaml
(and see how it actually fails).

  1. You could make a pull request with changes in this line
    opam-repository/packages/hashset/hashset.1.0.0/opam at master · ocaml/opam-repository · GitHub

I need to wait until a new version is released, as the current code
compiles fine, but it includes a change that is not in the tagged
version… In the meantime, I simply did an opam pin . in the git repo
of hashset, and all is well.

Thanks again!

Alan