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

cross-compilation regression on mirage #9199

Closed
Tracked by #9137
emillon opened this issue Nov 16, 2023 · 3 comments · Fixed by #9201
Closed
Tracked by #9137

cross-compilation regression on mirage #9199

emillon opened this issue Nov 16, 2023 · 3 comments · Fixed by #9201
Assignees
Labels

Comments

@emillon
Copy link
Collaborator

emillon commented Nov 16, 2023

Our mirage CI run is broken. The linking step fails with:

/usr/bin/ld: /home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp//libgmp.a(assert.o): in function `__gmp_assert_header':
assert.c:(.text+0x36): undefined reference to `__fprintf_chk'
/usr/bin/ld: /home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp//libgmp.a(assert.o): in function `__gmp_assert_fail':
assert.c:(.text+0x9a): undefined reference to `__fprintf_chk'
/usr/bin/ld: /home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp//libgmp.a(assert.o): in function `__gmp_assert_header':
assert.c:(.text+0x6c): undefined reference to `__fprintf_chk'
/usr/bin/ld: /home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp//libgmp.a(memory.o): in function `__gmp_default_allocate':
memory.c:(.text+0x42): undefined reference to `__fprintf_chk'
/usr/bin/ld: /home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp//libgmp.a(memory.o): in function `__gmp_default_reallocate':
memory.c:(.text+0x95): undefined reference to `__fprintf_chk'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:

I bisected that to #8740. I'll try to isolate a repro case.

@emillon emillon added the bug label Nov 16, 2023
@emillon emillon mentioned this issue Nov 16, 2023
26 tasks
@emillon
Copy link
Collaborator Author

emillon commented Nov 16, 2023

While diffing the logs, it looks like it picks the wrong context (- is the good build, + is the bad build)

 binary ocamldoc: found in /home/runner/work/dune/dune/_opam/bin
 binary x86_64-solo5-none-static-cc: found in /home/runner/work/dune/dune/_opam/bin
 binary ocamlopt: found in /home/runner/work/dune/dune/_opam/bin
-checking compilation with x86_64-solo5-none-static-cc -I/home/runner/work/dune/dune/_opam/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv -I/home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/solo5/lib/gmp/: working
+checking compilation with x86_64-solo5-none-static-cc -I/home/runner/work/dune/dune/_opam/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv -I/home/runner/work/dune/dune/mirage/_build/solo5/duniverse/Zarith/../../../install/default/lib/gmp/: working
 include caml/mlvalues.h: found
 library dynlink.cmxa: found
 binary ocamlfind: found in /home/runner/work/dune/dune/_opam/bin

@emillon
Copy link
Collaborator Author

emillon commented Nov 16, 2023

I think that the crux of the issue is that in this dune file:

(rule
 (target gmp.true)
 (deps
  (:exe configure_env.exe)
  %{lib:gmp:libgmp.a}
  %{lib:gmp:libgmp.so}
  %{lib:gmp:gmp.h})
 (action
  (with-stdout-to
   %{target}
   (run %{exe} --cc "%{cc}" --with-gmp=%{lib:gmp:libgmp.a}))))

We resolve %{lib:gmp:libgmp.a} in a different context:

-$ (cd _build/solo5/duniverse/Zarith && ../../../default/duniverse/Zarith/configure_env.exe --cc 'x86_64-solo5-none-static-cc -I/tmp/repro/_opam/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv' --with-gmp=../../../install/solo5/lib/gmp/libgmp.a) > _build/solo5/duniverse/Zarith/gmp.true
+$ (cd _build/solo5/duniverse/Zarith && ../../../default/duniverse/Zarith/configure_env.exe --cc 'x86_64-solo5-none-static-cc -I/tmp/repro/_opam/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv' --with-gmp=../../../install/default/lib/gmp/libgmp.a) > _build/solo5/duniverse/Zarith/gmp.true

emillon added a commit to emillon/dune that referenced this issue Nov 16, 2023
emillon added a commit to emillon/dune that referenced this issue Nov 16, 2023
@emillon
Copy link
Collaborator Author

emillon commented Nov 16, 2023

Repro in #9200

emillon added a commit to emillon/dune that referenced this issue Nov 16, 2023
rgrinberg pushed a commit that referenced this issue Nov 16, 2023
rgrinberg pushed a commit that referenced this issue Nov 16, 2023
emillon added a commit to emillon/dune that referenced this issue Nov 17, 2023
emillon added a commit that referenced this issue Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant