NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.75k stars 13.87k forks source link

Build failure: opam #306908

Closed momeemt closed 5 months ago

momeemt commented 5 months ago

Steps To Reproduce

I tried to add opam to devShell with flakes in my aarch64-darwin machine, then nix threw the following build error. Build logs from 0% to 96% are omitted due to character limit.

Build log

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/22dj4sy1d16hxyjkdpxy7qh4688i438k-2.1.5.zip
source root is opam-2.1.5
'opam-2.1.5/src_ext/0install-solver.tbz' -> '/nix/store/31rq8pkld14pwvjnnvzly0gfg2r7dqv7-0install-v2.17.tbz'
'opam-2.1.5/src_ext/base64.tbz' -> '/nix/store/k6prmng2v9vhpk89f6jjkh4zszwci71p-base64-v3.5.0.tbz'
'opam-2.1.5/src_ext/cmdliner.tbz' -> '/nix/store/gd74q3ywizflzdkqcfgzj4jh5rqp6smg-cmdliner-1.0.4.tbz'
'opam-2.1.5/src_ext/cppo.tar.gz' -> '/nix/store/47c1fw7hbjh0phirxy3jk5myghagsjpm-v1.6.8.tar.gz'
'opam-2.1.5/src_ext/cudf.tar.gz' -> '/nix/store/4i059nac0jw26i3j6jcfw7nq7argci08-cudf-v0.10.tar.gz'
'opam-2.1.5/src_ext/dose3.tar.gz' -> '/nix/store/gk3r9ibqf43dzlwwglkq0l084fvi6ql4-dose3-7.0.0.tar.gz'
'opam-2.1.5/src_ext/dune-local.tbz' -> '/nix/store/gcmkykp6idwxp1fxh3f6qqpwa2v1hmn4-dune-3.5.0.tbz'
'opam-2.1.5/src_ext/extlib.tar.gz' -> '/nix/store/qgiyiwfbq31mirzqxn7s0kg5bxk1a789-extlib-1.7.9.tar.gz'
'opam-2.1.5/src_ext/mccs.tar.gz' -> '/nix/store/yh6pkzywr3lgs4c41kbcsa4aq15nj3zj-1.1+13.tar.gz'
'opam-2.1.5/src_ext/ocamlgraph.tbz' -> '/nix/store/vjbc4y1q17bhapgphnafb237sk2v5a4i-ocamlgraph-2.0.0.tbz'
'opam-2.1.5/src_ext/opam-0install-cudf.tbz' -> '/nix/store/xgg8n04xfchjhl0np2vkscwz3n1gjm2m-opam-0install-cudf-v0.4.2.tbz'
'opam-2.1.5/src_ext/opam-file-format.tar.gz' -> '/nix/store/qad6nbmakq8japfzxs365r6xrvq1sld2-2.1.4.tar.gz'
'opam-2.1.5/src_ext/re.tbz' -> '/nix/store/40g10ggv51pv2fsdd845k7y57h2h2hlb-re-1.10.3.tbz'
'opam-2.1.5/src_ext/result.tbz' -> '/nix/store/djynli02dsja16dbn2zgwmwg7a4rivhh-result-1.5.tbz'
'opam-2.1.5/src_ext/seq.tar.gz' -> '/nix/store/qaf1bq25kzlm8viq9xi4qr4sxjn0d230-0.2.2.tar.gz'
'opam-2.1.5/src_ext/stdlib-shims.tbz' -> '/nix/store/4s1xcdc1k3jqlprql3f5c6pdadwmhi47-stdlib-shims-0.3.0.tbz'
setting SOURCE_DATE_EPOCH to timestamp 1683908395 of file opam-2.1.5/tests/reftests/working-dir.test
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
applying patch /nix/store/2186jcnjk3gnajnh2pmg6322kgp43g95-opam-shebangs.patch
patching file src/client/opamInitDefaults.ml
Hunk #1 succeeded at 46 (offset 11 lines).
Hunk #2 succeeded at 79 with fuzz 2 (offset 25 lines).
Hunk #3 succeeded at 156 (offset 34 lines).
patching file src/state/opamScript.mli
patching file src/state/shellscripts/patch_shebangs.sh
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
patching script interpreter paths in src/state/shellscripts
src/state/shellscripts/patch_shebangs.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/j9p4zcg5xylhn756w2y5n02mwpycdh9h-bash-5.2-p15/bin/bash"
configure flags: --prefix=/nix/store/4cakg03jw31bg416b6y7a2pqnhp9rgnm-opam-2.1.5
checking for ocamlc... ocamlc
OCaml version is 4.14.2
OCaml library path is /nix/store/xz2bfz91wz9khif6yws8v9ca5zbqkq6x-ocaml-4.14.2/lib/ocaml
checking for ocamlopt... ocamlopt
checking for ocamlc.opt... ocamlc.opt
checking for ocamlopt.opt... ocamlopt.opt
checking for ocaml... ocaml
checking for ocamldep... ocamldep
checking for ocamldep.opt... ocamldep.opt
checking for ocamlmktop... ocamlmktop
checking for ocamlmklib... ocamlmklib
checking for ocamldoc... ocamldoc
checking for ocamldoc.opt... ocamldoc.opt
checking for ocamlbuild... no
checking OCaml Sys.os_type... Unix
checking for gawk... gawk
checking for compiler type... cc
checking for compiler architecture... arm64
checking for compiler system... macosx
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether clang accepts -g... yes
checking for clang option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for acl/libacl.h... no
checking for library containing acl_get_perm... no
checking for ocamlobjinfo... ocamlobjinfo
checking for ocamlfind... no
checking for curl... curl
checking for dune... no
checking for cppo... no
checking for patch... patch
checking for bunzip2... bunzip2

checking for OCaml findlib package unix... not found
checking for OCaml findlib package bigarray... not found
checking for OCaml findlib package extlib... not found
checking for OCaml findlib package re... not found
checking for OCaml findlib package re.glob... not found
checking for OCaml findlib package cmdliner... not found
checking for OCaml findlib package ocamlgraph... not found
checking for OCaml findlib package cudf... not found
checking for OCaml findlib package dose3.common... not found
checking for OCaml findlib package dose3.algo... not found
checking for OCaml findlib package opam-file-format... not found
checking for OCaml findlib package mccs... not found
checking for OCaml findlib package opam-0install-cudf... not found
checking whether the compiler supports GNU C++... yes
checking whether clang++ accepts -g... yes
checking for clang++ option to enable C++11 features... none needed

============================================================================
Some dependencies are missing. If you are just interested in the stand-alone
'opam' binary, run 'make lib-ext' to download and include them.
============================================================================

configure: creating ./config.status
config.status: creating Makefile.config
config.status: creating src/ocaml-flags-configure.sexp
config.status: creating src/stubs/c-flags.sexp
config.status: creating src/stubs/libacl/c-libraries.sexp

Opam will be built WITH a built-in solver

Executables will be installed in /nix/store/4cakg03jw31bg416b6y7a2pqnhp9rgnm-opam-2.1.5/bin
Manual pages will be installed in /nix/store/4cakg03jw31bg416b6y7a2pqnhp9rgnm-opam-2.1.5/share/man
make -j -C src_ext lib-ext
make[1]: Entering directory '/private/tmp/nix-build-opam-2.1.5.drv-1/opam-2.1.5/src_ext'
mkdir -p tmp-dune-local
mkdir -p tmp-cppo
mkdir -p tmp-base64
mkdir -p tmp-extlib
mkdir -p tmp-re
mkdir -p tmp-cmdliner
mkdir -p tmp-ocamlgraph
mkdir -p tmp-cudf
mkdir -p tmp-dose3
mkdir -p tmp-opam-file-format
mkdir -p tmp-result
mkdir -p tmp-seq
mkdir -p tmp-stdlib-shims
mkdir -p tmp-mccs
cd tmp-base64 && bunzip2 -c ../base64.tbz | tar xf -
cd tmp-cppo && gunzip -c ../cppo.tar.gz | tar xf -
cd tmp-dune-local && bunzip2 -c ../dune-local.tbz | tar xf -
cd tmp-stdlib-shims && bunzip2 -c ../stdlib-shims.tbz | tar xf -
cd tmp-cudf && gunzip -c ../cudf.tar.gz | tar xf -
cd tmp-mccs && gunzip -c ../mccs.tar.gz | tar xf -
cd tmp-seq && gunzip -c ../seq.tar.gz | tar xf -
cd tmp-result && bunzip2 -c ../result.tbz | tar xf -
cd tmp-opam-file-format && gunzip -c ../opam-file-format.tar.gz | tar xf -
cd tmp-dose3 && gunzip -c ../dose3.tar.gz | tar xf -
cd tmp-ocamlgraph && bunzip2 -c ../ocamlgraph.tbz | tar xf -
cd tmp-cmdliner && bunzip2 -c ../cmdliner.tbz | tar xf -
cd tmp-re && bunzip2 -c ../re.tbz | tar xf -
cd tmp-extlib && gunzip -c ../extlib.tar.gz | tar xf -
rm -rf base64
rm -rf stdlib-shims
rm -rf result
rm -rf cmdliner
rm -rf re
rm -rf seq
rm -rf cppo
rm -rf ocamlgraph
rm -rf opam-file-format
rm -rf mccs
rm -rf extlib
rm -rf cudf
patching file src/cmdliner_docgen.ml
patching file src/base64.ml
patching file src/base64.mli
patching file src/dune
patching file src/cmdliner.ml
patching file src/cmdliner.mli
patching file src/cmdliner_arg.ml
patching file src/cmdliner_arg.mli
patching file src/cmdliner_base.ml
patching file src/cmdliner_cline.ml
patching file src/cmdliner_cline.mli
patching file src/cmdliner_docgen.ml
patching file src/cmdliner_manpage.ml
patching file src/cmdliner_term.ml
patching file src/cmdliner_term.mli
patching file src/dune
patching file src/dot_lexer.mll
rm -rf dose3
patching file src/lp_solver.cpp
patching file src/dune
patching file lib/dune
rm -f seq/src/seq.ml seq/src/seq.mli
patching file src/common/dune
patching file src/common/util.ml
rm -rf dune-local
make[1]: Leaving directory '/private/tmp/nix-build-opam-2.1.5.drv-1/opam-2.1.5/src_ext'
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
build flags: SHELL=/nix/store/j9p4zcg5xylhn756w2y5n02mwpycdh9h-bash-5.2-p15/bin/bash TERM=screen
cd src_ext/dune-local && ocaml bootstrap.ml
ocamlc -output-complete-exe -w -24 -g -o .duneboot.exe -I boot unix.cma boot/libs.ml boot/duneboot.ml
./.duneboot.exe

src_ext/dune-local/dune.exe build --profile=release --root .  --promote-install-files -- opam-installer.install opam.install
Scanned 0 directories

<Build logs from 0% to 96% are omitted due to character limit.>

Done: 96% (2468/2552, 84 left) (jobs: 1)

File "src/client/dune", line 27, characters 15-23:
27 |   (name        opamMain)
                    ^^^^^^^^
Undefined symbols for architecture arm64:
  "operator delete[](void*)", referenced from:
      _call_solver in libmccs_stubs.a(mccs_stubs.o)
  "operator delete(void*)", referenced from:
      ml2c_vpkg(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      Virtual_packages::get(char const*) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_vpkglist(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_vpkgformula(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_property(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_propertylist(std::__1::vector<CUDFPropertyValue*, std::__1::allocator<CUDFPropertyValue*>>&, Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_package(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, int&, long) in libmccs_stubs.a(mccs_stubs.o)
      ...
  "operator new[](unsigned long)", referenced from:
      _call_solver in libmccs_stubs.a(mccs_stubs.o)
  "operator new(unsigned long)", referenced from:
      ml2c_vpkg(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      Virtual_packages::get(char const*) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_vpkglist(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_vpkgformula(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_property(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_propertylist(std::__1::vector<CUDFPropertyValue*, std::__1::allocator<CUDFPropertyValue*>>&, Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_package(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, int&, long) in libmccs_stubs.a(mccs_stubs.o)
      ...
  "___cxa_allocate_exception", referenced from:
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(mccs_stubs.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccs_stubs.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccscudf.o)
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(mccscudf.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(lp_solver.o)
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(lp_solver.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(glpk_solver.o)
      ...
  "___cxa_begin_catch", referenced from:
      call_mccs_protected(Solver, char*, int, CUDFproblem*) in libmccs_stubs.a(mccs_stubs.o)
      ___clang_call_terminate in libmccs_stubs.a(mccs_stubs.o)
      glpk_solver::solve(int) in libmccs_stubs.a(glpk_solver.o)
      ___clang_call_terminate in libmccs_stubs.a(glpk_solver.o)
  "___cxa_end_catch", referenced from:
      call_mccs_protected(Solver, char*, int, CUDFproblem*) in libmccs_stubs.a(mccs_stubs.o)
      glpk_solver::solve(int) in libmccs_stubs.a(glpk_solver.o)
  "___cxa_free_exception", referenced from:
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccs_stubs.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccscudf.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(lp_solver.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(glpk_solver.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(cudf_reductions.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(constraint_generation.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(new_criteria.o)
      ...
  "___cxa_rethrow", referenced from:
      glpk_solver::solve(int) in libmccs_stubs.a(glpk_solver.o)
  "___cxa_throw", referenced from:
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(mccs_stubs.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccs_stubs.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(mccscudf.o)
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(mccscudf.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(lp_solver.o)
      std::__throw_bad_array_new_length[abi:v160006]() in libmccs_stubs.a(lp_solver.o)
      std::__1::__throw_length_error[abi:v160006](char const*) in libmccs_stubs.a(glpk_solver.o)
      ...
  "___gxx_personality_v0", referenced from:
      ml2c_vpkg(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      Virtual_packages::get(char const*) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_vpkglist(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_property(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_package(Virtual_packages*, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, CUDFProperty*, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, CUDFProperty*>>>*, int&, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_propertydef(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ml2c_propertydeflist(Virtual_packages*, long) in libmccs_stubs.a(mccs_stubs.o)
      ...
ld: symbol(s) not found for architecture arm64
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
Done: 96% (2468/2552, 84 left) (jobs: 1)

make: *** [Makefile:135: build-opam] Error 1

Notify maintainers

@henrytill @marsam

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
these 2 paths will be fetched (0.01 MiB download, 0.11 MiB unpacked):
  /nix/store/py1db6645s7xk8ijgab5q3h30rcq9z24-DarwinTools-1
  /nix/store/mlyzv6g6md0ib3y3844afd84656vxvrf-nix-info
copying path '/nix/store/py1db6645s7xk8ijgab5q3h30rcq9z24-DarwinTools-1' from 'https://cache.nixos.org'...
copying path '/nix/store/mlyzv6g6md0ib3y3844afd84656vxvrf-nix-info' from 'https://cache.nixos.org'...
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.4.0, macOS 14.4.1`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"darwin, nixpkgs"`
 - nixpkgs: `/Users/momeemt/.nix-defexpr/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

momeemt commented 5 months ago

I'm sorry that I misunderstand these build error messages. It doesn't failed to build dune_3, but opam.

vbgl commented 5 months ago

It seems that you are running into this bug: https://github.com/ocaml/dune/issues/949

wegank commented 5 months ago

This is the same issue that occurred between December 5 and 17 last year on master, which has been since fixed, see https://hydra.nixos.org/job/nixpkgs/trunk/opam.aarch64-darwin/all. I suspect it could be a problem with outdated flake inputs.

momeemt commented 5 months ago

@wegank I apologise for the late reply. I tried to use nixpkgs-unstable, then I could add opam to devShell. Thanks for teaching me! I will try to confirm in the master branch from now on. :bow: