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

Two build failures during cross-compilation #1115

Open
avnik opened this issue Oct 15, 2023 · 2 comments
Open

Two build failures during cross-compilation #1115

avnik opened this issue Oct 15, 2023 · 2 comments

Comments

@avnik
Copy link

avnik commented Oct 15, 2023

Both failures are build of ocaml itself
I cut most interesting parts from logs (patching, detecting architectures, and failure itself), but could provide full logs if needed.
You can see, that patches from overlay not applied, and so build of cross compiler fails.

I isolated problem to minimal flake, which illustrating how I used it -- https://github.com/avnik/nixpkgs-cross-build-repro/tree/avnik/ocaml-cross-overlay-repro
Could you hint, if I used overlay in wrong way or help me debug this issue if usage of overlay is correct.
Will be grateful for your help.

unpacking sources
unpacking source archive /nix/store/121nmhs8zpd9729jhmskvsd6n010cwim-ocaml-4.14.1.tar.xz
source root is ocaml-4.14.1
setting SOURCE_DATE_EPOCH to timestamp 1671539204 of file ocaml-4.14.1/yacc/wstr.c
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.guess
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
fixing libtool script ./build-aux/ltmain.sh
./configure
configure flags: --disable-static -prefix /nix/store/dzn0inc8w11bs0lwh5x12nzapf74l323-ocaml+flambda-4.14.1 --enable-flambda --host=x86_64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu
configure: Configuring OCaml version 4.14.1
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
...
make[5]: Entering directory '/build/ocaml-4.14.1/api_docgen/ocamldoc'
mkdir -p build/
cp ../../api_docgen/Ocaml_operators.mld build/Ocaml_operators.mld
mkdir -p build/libref
../../boot/ocamlrun ./../../ocamldoc/ocamldoc -I ../../stdlib -I ../../otherlibs/str -I ../../otherlibs/unix -I ../../otherlibs/dynlink -I ../../otherlibs/systhreads -text build/Ocaml_operato>
Fatal error: cannot load shared library dllunix
Reason: dllunix.so: cannot open shared object file: No such file or directory
make[5]: *** [Makefile:60: build/libref/Ocaml_operators.odoc] Aborted (core dumped)

And build for target

unpacking source archive /nix/store/121nmhs8zpd9729jhmskvsd6n010cwim-ocaml-4.14.1.tar.xz
source root is ocaml-4.14.1
setting SOURCE_DATE_EPOCH to timestamp 1671539204 of file ocaml-4.14.1/yacc/wstr.c
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.guess
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.sub
Updating Autotools / GNU config script to a newer upstream version: ./build-aux/config.guess
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
fixing libtool script ./build-aux/ltmain.sh
./configure
configure flags: --disable-static -prefix /nix/store/qhqzlxgw5i89pynx9mgwg6arv70r14x6-ocaml+flambda-aarch64-unknown-linux-gnu-4.14.1 --enable-flambda --host=aarch64-unknown-linux-gnu --target=aarch64-unknown-linux-gnu
configure: Configuring OCaml version 4.14.1
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
...
aarch64-unknown-linux-gnu-gcc -c -O2 -fno-strict-aliasing -fwrapv -pthread -Wall -Wdeclaration-after-statement -fno-common -fexcess-precision=standard -ffunction-sections -g  -D_FILE_OFFSET_BITS=64 -DCAML_NAME_SPACE  -DCAMLDLLIMPORT=  -o startup_byt.b.o startup_byt.c
In file included from caml/alloc.h:23,
                 from startup_byt.c:32:
startup_byt.c: In function 'do_print_config':
caml/misc.h:382:32: error: too few arguments to function 'caml_stat_strdup'
  382 | #define caml_stat_strdup_of_os caml_stat_strdup
      |                                ^~~~~~~~~~~~~~~~
startup_byt.c:382:10: note: in expansion of macro 'caml_stat_strdup_of_os'
  382 |          caml_stat_strdup_of_os(OCAML_STDLIB_DIR));
      |          ^~~~~~~~~~~~~~~~~~~~~~
In file included from startup_byt.c:49:
caml/memory.h:161:29: note: declared here
  161 | CAMLextern caml_stat_string caml_stat_strdup(const char *s);
      |                             ^~~~~~~~~~~~~~~~
make[2]: *** [Makefile:366: startup_byt.b.o] Error 1
@anmonteiro
Copy link
Collaborator

I don't know if our cross-compilation support can work with import ... { system = ... }. You might be luckier using pkgsCross.aarch64_multiplatform{,_musl}.

@avnik
Copy link
Author

avnik commented Aug 10, 2024

@anmonteiro main problem -- we cross-compile whole system, not just few packages

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

2 participants