Closed UnixJunkie closed 1 year ago
It looks like the latest commit 5845999 fixes this? Will a new version of obuild with this fix be published to OPAM, please?
I have a project relying on the opam published version of Jean-Christophe Filliâtre's hashset package, which uses obuild to compile. So it would be preferable to have the published obuild package building with OCaml >= 5.x
Thanks!
Maybe, you could also pass hashset to dune and be safe for the long term.
I can create a new version easily, but I don't know how to update the opam package. I need to check that.
@UnixJunkie yes, I will submit a pull request for porting hashset to dune. @jeromemaloberti I think it would still be good to have the OPAM version of obuild up to date.
I created the tag and updated the repo. But I'm struggling with the update of opam-repo.
Do you want some input on this? If you give more details, maybe I can help out?
I never updated it, so it is new. But I'm confused because:
https://github.com/ocaml/opam-repository/pull/24722 Wait and see.
You updated as I was writing this ... but for reference:
The problem might be because the opam
file is specifying opam version 1.2, and opam-publish
states that you need to be using OPAM version >=2.0.
You may also need to extend the opam
file (e.g. adding the package version number there).
I updated the opam file https://github.com/ocaml-obuild/obuild/blob/master/opam But I forgot to commit it. I didn't put the package version number, though.
I added the package version and the project name. But I had to commit it before opam decided to compile and install it. So, it seems to only consider files in git ??
Yes, well OPAM pulls the code from the repository you specify, so if the changes are not there then they are not visible.
You need to check the results of the CI tests.
opam
file:
I fixed them and pushed to opam-repo.
Lint complained about "version" and "project", but not on my computer.
If I put unix in depends, it fails to compile on 4.x ... I guess I need to put a condition ... But which one ?
@reubenrowe I'm stuck, if I put "unix" in depends, 4.x skips the build because it is unknown. But if I put "base-unix", 5.x complains that unix is missing.
@jeromemaloberti OK, I will spend some time later today trying to figure this out on my own local copy of obuild
Thank you. I added depopts: ["unix" {"ocaml" >= "5.0.0"}] which seems to help a bit, but some platform (arm, ppc and bsd ?) are still failing ...
OK, so I think the problem might be that obuild
actually depends on ocamfind
to build itself, and this isn't reflected in the opam
file. I guess some of the test environments used in the CI pipeline must have ocamlfind
installed by default, while others don't; and it is the ones that don't have it pre-installed that are failing.
You don't need any depopts: [...]
in the opam
file, but you do need depends: [ "ocaml" "ocamlfind" {build} ]
.
obuild doesn't need ocamlfind, but it needs the META files. It is also possible that the resolution of dependencies changed between 4 and 5, and the option "+unix" is resolved differently now. I pushed a change, and waiting for the result.
It does depend on ocamlfind! At least in the sense that it tries to use it.
https://github.com/ocaml-obuild/obuild/blob/master/obuild/findlibConf.ml#L37
This is ultimately the cause of the build going wrong for OCaml versions 5.x.
The failure is after the obuild.bootstrap
executable has been built by the bootstrap
script (which succeeds), and it then tries to run it with the configure
command.
https://github.com/ocaml-obuild/obuild/blob/master/bootstrap#L103
This reads the obuild.obuild
configuration file, which lists the unix
library as a dependency in several places. Part of the configuration is to find the location of this library.
Before OCaml 5.x, the unix.cm*
files were in the root directory of the standard library path, and so the library was picked up automatically (by the Analyze.initializeSystemStdlib
function) and stored in the Metacache.pkgs_cache
hashtable.
From OCaml 5.1, the location of this library has been moved to a subdirectory, and so it is not added to the packages cache automatically. Then, ocambuild
falls back on trying to call ocamlfind
to look up the location of the library. Thus, without ocamlfind
, the tool will fail to find the library.
So, one solution is to add ocamlfind
as dependency. We can see now that this has now solved the problems in the OPAM CI pipeline.
Another solution is to modify Analyze.initializeSystemStdlib
function so that it recurses into subdirectories looking for libraries.
Thank you. That's clear now. It has been merged, so I will close the issue. Thank you very much for your help with opam.
I don't need it, this is just FYI.