Skip to content
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

fail to build zarith dependancy in monorepo for hvt target #1

Closed
RyanGibb opened this issue Sep 21, 2022 · 7 comments
Closed

fail to build zarith dependancy in monorepo for hvt target #1

RyanGibb opened this issue Sep 21, 2022 · 7 comments

Comments

@RyanGibb
Copy link
Owner

www-dev> File "duniverse/Zarith/dune", line 24, characters 0-159:
www-dev> 24 | (rule
www-dev> 25 |  (target Makefile)
www-dev> 26 |  (deps configure config.guess env)
www-dev> 27 |  (action
www-dev> 28 |   (bash
www-dev> 29 |    "env %{read:env} ./configure --ocamllibdir %{ocaml-config:standard_library}")))
www-dev> binary ocaml: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> binary ocamlc: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> binary ocamldep: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> binary ocamlmklib: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> binary ocamldoc: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> binary x86_64-solo5-none-static-cc: found in /nix/store/8wq2cpj1pavj1ks771wxj97hxpwg347v-solo5-0.7.3/bin
www-dev> binary ocamlopt: found in /nix/store/28sj9b4cj9z8h11zs002xja7136b21ri-ocaml-4.14.0/bin
www-dev> checking compilation with x86_64-solo5-none-static-cc -I/nix/store/zm57y1mxc52kji4jvg5yc3z7l42zfl9p-ocaml-solo5-0.8.1/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv : working
www-dev> include caml/mlvalues.h: found
www-dev> library dynlink.cmxa: found
www-dev> binary ocamlfind: found in /nix/store/y8v64yx17fkk11y3qj8iry09awhrkp6b-ocamlfind-1.9.5/bin
www-dev> OCaml's word size is 64
www-dev> binary uname: found in /nix/store/n95s7s6ilkjc7xwqml93acxzj6k0hsfn-coreutils-9.1/bin
www-dev> include gmp.h: found
www-dev> library gmp: not found
www-dev> include mpir.h: not found
www-dev> cannot find GMP nor MPIR
@RyanGibb
Copy link
Owner Author

RyanGibb commented Sep 21, 2022

zarith/configure doesn't seem to pick up the gmp library. Strangely it does find the header though.

@RyanGibb RyanGibb changed the title fail to build zarith dependancy in monorepo fail to build zarith dependancy in monorepo for hvt target Sep 21, 2022
@RyanGibb
Copy link
Owner Author

RyanGibb commented Sep 22, 2022

possibilities:

  • ./configure does some weird stuff to ignore NIX_LDFLAGS (like not using gcc-wrapper
    • building zarith locally would seem to imply this is not the case as it works when setting NIX_LDFLAGS with a nix shell or manually setting LDFLAGS=-L/nix/store/<hash>-gmp-with-cxx-6.2.1/lib
  • dune build is doing some sandboxing preventing gcc-wrapper being used or NIX_LDFLAGS read
    • building zarith locally would seem to imply this is also not the case as it works inside a dune build
  • it's a problem with building in a nix derivation for some reason?
    • again building zarith locally works fine in a nix derivation

@RyanGibb
Copy link
Owner Author

The fact that this works for unix but not hvt implies it's a cross compilation issue

@RyanGibb
Copy link
Owner Author

This seems to be because https://github.com/mirage/ocaml-gmp isn't being picked up in our monorepo. It worked for unix as we used the system dependancy

@RyanGibb
Copy link
Owner Author

So Zarith depends on ("gmp" | "conf-gmp" ) which opam admin list in tweag/opam-nix doesn't seem to pick up.

We should look at using opam-monorepo

@RyanGibb
Copy link
Owner Author

RyanGibb commented Sep 22, 2022

Manually adding gmp = "*" to the monorepo query results in:

 www-dev> File "duniverse/ocaml-gmp/src/dune", line 25, characters 0-110:
 www-dev> 25 | (rule
 www-dev> 26 |  (targets build.sh)
 www-dev> 27 |  (deps build.sh.in)
 www-dev> 28 |  (mode fallback)
 www-dev> 29 |  (action
 www-dev> 30 |   (run opam config subst "build.sh")))
 www-dev> Error: Rule failed to generate the following targets:
 www-dev> - duniverse/ocaml-gmp/src/build.sh

@RyanGibb
Copy link
Owner Author

RyanGibb commented Sep 23, 2022

Fixed by RyanGibb/hillingar@b6e7205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant