NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.2k stars 1.47k forks source link

Freebsd cross-compilation fails to link libexpr-c #11546

Open Mic92 opened 3 days ago

Mic92 commented 3 days ago

Describe the bug

$ nix develop .#packages.x86_64-linux.nix-x86_64-unknown-freebsd $ ./configure $configureFlags $ make

x86_64-unknown-freebsd-ld: error: undefined symbol: operator new(unsigned long, std::align_val_t)
>>> referenced by nix_api_expr.cc:108 (src/libexpr-c/nix_api_expr.cc:108)
>>>               src/libexpr-c/nix_api_expr.o:(nix_state_create)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mk/lib.mk:84: src/libexpr-c/libnixexprc.so] Error 1

Is freebsd not linking libc++ correctly?

Mic92 commented 3 days ago

cc @rhelmot @Ericson2314 who may have interest in this.

Mic92 commented 3 days ago

@rhelmot says it's because of wrong llvm configuration and it might be fixed in master. Will test this.

Mic92 commented 3 days ago

Switching to nixpkgs unstable fixes it.

Ericson2314 commented 3 days ago

The alignment of this is probably uninteresting, so we could write some fallback code too.

roberth commented 2 days ago

I think we should switch to nixos-unstable anyway, because we're developing for 24.11 at this point in time.