-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
ocamlPackages.zmq: fix build with non-default OCaml #49921
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
Conversation
@GrahamcOfBorg build ocamlPackages_latest.zmq |
Success on x86_64-darwin (full log) Attempted: ocamlPackages_latest.zmq Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: ocamlPackages_latest.zmq Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: ocamlPackages_latest.zmq Partial log (click to expand)
|
buildDunePackage rec { | ||
pname = "zmq"; | ||
version = "20180726"; | ||
if !stdenv.lib.versionAtLeast ocaml.version "4.03" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot this version constraint also be applied while still using buildDunePackage
?
else | ||
|
||
let __dune = dune; in | ||
let dune = __dune.override { ocamlPackages = { inherit ocaml findlib; }; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the fix, isn't it? Can you add a comment explaining how this is necessary that dune is built with the exact same version of OCaml and findlib? In the past, you told me that dune
was not part of ocamlPackages
because it was an independent tool but in the end, if it had been part of ocamlPackages
none of this fix would have been necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dune is changing fast these days…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is no reason why the compiler used to build the build system would need to be the same as the compiler used to build the software.
Maybe we should think more about cross-compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no reason why the compiler used to build the build system
There are two reasons:
- you do it here because it is needed to make this package compile
- dune was thought in the context of the OCaml ecosystem which is mostly managed through opam. This means that people install dune with opam in the same switch that they use to compile. Therefore, dune developers never have to consider a scenario where the OCaml version to compile dune was not the same than the one used to compile the considered project. Maybe that's why they build with OCaml versions as old as 4.02 (which doesn't make a lot of sense for such a rapidly evolving project). Maybe an issue should be raised about this on the dune repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both reasons are invalid:
-
I do it here because the builder does not cover this case yet: we first need to build the build-system, and then run it to build the package. Since in the current state, both must be done in the same environment, there is only one version of OCaml available.
-
Some people do use
opam
to do cross-compilation. In particular they manage to runppx
at build-time.
Motivation for this change
The
zmq
library currently only builds with the default version of OCaml.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)