Skip to content

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

Merged
merged 1 commit into from
Dec 5, 2018

Conversation

vbgl
Copy link
Contributor

@vbgl vbgl commented Nov 8, 2018

Motivation for this change

The zmq library currently only builds with the default version of OCaml.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Nov 8, 2018
@vbgl
Copy link
Contributor Author

vbgl commented Nov 8, 2018

@GrahamcOfBorg build ocamlPackages_latest.zmq

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: ocamlPackages_latest.zmq

Partial log (click to expand)

      ocamlc zmq/src/poll.o
clang-5.0: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
installing
Processing file zmq.install as zmq.
post-installation fixup
moving /nix/store/ldkphdh33iglp0hnbda0h3mhc821g7s9-ocaml4.07.1-zmq-20180726/doc to /nix/store/ldkphdh33iglp0hnbda0h3mhc821g7s9-ocaml4.07.1-zmq-20180726/share/doc
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/ldkphdh33iglp0hnbda0h3mhc821g7s9-ocaml4.07.1-zmq-20180726/lib
patching script interpreter paths in /nix/store/ldkphdh33iglp0hnbda0h3mhc821g7s9-ocaml4.07.1-zmq-20180726
/nix/store/ldkphdh33iglp0hnbda0h3mhc821g7s9-ocaml4.07.1-zmq-20180726

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: ocamlPackages_latest.zmq

Partial log (click to expand)

moving /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/doc to /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/share/doc
shrinking RPATHs of ELF executables and libraries in /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726
shrinking /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/zmq/deferred/zmq_deferred.cmxs
shrinking /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/zmq/zmq.cmxs
shrinking /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/stublibs/dllzmq_stubs.so
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726/lib
patching script interpreter paths in /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726
checking for references to /build in /nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726...
/nix/store/a49xls7wvm7lkwgsvaprq8jb3i6il6y0-ocaml4.07.1-zmq-20180726

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: ocamlPackages_latest.zmq

Partial log (click to expand)

moving /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/doc to /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/share/doc
shrinking RPATHs of ELF executables and libraries in /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726
shrinking /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/stublibs/dllzmq_stubs.so
shrinking /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/zmq/zmq.cmxs
shrinking /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/lib/ocaml/4.07.1/site-lib/zmq/deferred/zmq_deferred.cmxs
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726/lib
patching script interpreter paths in /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726
checking for references to /build in /nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726...
/nix/store/3d9mi4bn26nk401pnd67mwxg9ah0l7ln-ocaml4.07.1-zmq-20180726

buildDunePackage rec {
pname = "zmq";
version = "20180726";
if !stdenv.lib.versionAtLeast ocaml.version "4.03"
Copy link
Member

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; }; };
Copy link
Member

@Zimmi48 Zimmi48 Nov 9, 2018

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.

Copy link
Contributor Author

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…

https://dune.readthedocs.io/en/latest/configurator.html

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both reasons are invalid:

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

  2. Some people do use opam to do cross-compilation. In particular they manage to run ppx at build-time.

@vbgl vbgl merged commit b341134 into NixOS:master Dec 5, 2018
@vbgl vbgl deleted the ocaml-zmq-fix branch December 5, 2018 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: clean-up 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants