NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.48k stars 14.4k forks source link

llvmPackages_15: missing libffi.so.8 at runtime #214282

Closed nektro closed 1 year ago

nektro commented 1 year ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. trying to build https://github.com/ziglang/zig.git from source
  2. mkdir build && cd build
  3. cmake ..
  4. make install
with import <nixpkgs> {};

pkgs.mkShell {
  nativeBuildInputs = with pkgs; [
    cmake
    gdb
    libxml2
    ninja
    qemu
    wasmtime
    zlib
  ] ++ (with llvmPackages_15; [
    clang
    clang-unwrapped
    lld
    llvm
  ]);

  hardeningDisable = [ "all" ];
}

Build log

[nix-shell:~/src/zig/build]$ cmake ..
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/1y8i61anhs9hh1g5x3zw2fvdbivwixzg-gcc-wrapper-11.3.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/1y8i61anhs9hh1g5x3zw2fvdbivwixzg-gcc-wrapper-11.3.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring zig version 0.11.0-dev.1465+d64dd75e3
-- Found llvm: -lLLVM-15;-lrt;-ldl;-lm;-lz;-ltinfo;-lxml2 (Required is at least version "15") 
-- Found clang: /nix/store/yws5gcxdm5sdq5wrldh2bj47vb0i0nv8-clang-15.0.7-lib/lib/libclang-cpp.so.15 (Required is at least version "15") 
-- Found lld: /nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldMinGW.a;/nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldELF.a;/nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldCOFF.a;/nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldWasm.a;/nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldMachO.a;/nix/store/nzacynck36m2fkl4p8m7m4jx78dcg7hs-lld-15.0.7-lib/lib/liblldCommon.a (Required is at least version "15") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/meghan/src/zig/build

[nix-shell:~/src/zig/build]$ make install
[  5%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm.cpp.o
[ 10%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_llvm-ar.cpp.o
[ 15%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang.cpp.o
[ 20%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_driver.cpp.o
[ 25%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1_main.cpp.o
[ 30%] Building CXX object CMakeFiles/zigcpp.dir/src/zig_clang_cc1as_main.cpp.o
[ 35%] Building CXX object CMakeFiles/zigcpp.dir/src/windows_sdk.cpp.o
[ 40%] Linking CXX static library zigcpp/libzigcpp.a
[ 40%] Built target zigcpp
[ 45%] Building C object CMakeFiles/zig-wasm2c.dir/stage1/wasm2c.c.o
[ 50%] Linking C executable zig-wasm2c
[ 50%] Built target zig-wasm2c
[ 55%] Converting /home/meghan/src/zig/stage1/zig1.wasm to /home/meghan/src/zig/build/zig1.c
[ 60%] Building C object CMakeFiles/zig1.dir/zig1.c.o
[ 65%] Building C object CMakeFiles/zig1.dir/stage1/wasi.c.o
[ 70%] Linking C executable zig1
[ 70%] Built target zig1
[ 75%] Running zig1.wasm to produce /home/meghan/src/zig/build/zig2.c
[ 80%] Running zig1.wasm to produce /home/meghan/src/zig/build/compiler_rt.c
[ 85%] Building C object CMakeFiles/zig2.dir/zig2.c.o
/home/meghan/src/zig/build/zig2.c: In function ‘crypto_blake3_Output_chainingValue’:
/home/meghan/src/zig/build/zig2.c:2576006: warning: ‘crypto_blake3_CompressGeneric_compress’ reading 64 bytes from a region of size 32 [-Wstringop-overread]
2576006 |  t11 = crypto_blake3_CompressGeneric_compress(t2, t4, t6, t8, t10);
        | 
/home/meghan/src/zig/build/zig2.c:2576006: note: referencing argument 2 of type ‘const zig_u32 * const’ {aka ‘const unsigned int * const’}
/home/meghan/src/zig/build/zig2.c:2736956: note: in a call to function ‘crypto_blake3_CompressGeneric_compress’
2736956 | static zig_T_tuple_7b_5b16_5du32_7d_60048 crypto_blake3_CompressGeneric_compress(zig_u32 const a0[zig_const_arr zig_as_u64(8)], zig_u32 const a1[zig_const_arr zig_as_u64(16)], zig_u32 const a2, zig_u64 const a3, zig_u8 const a4) {
        | 
/home/meghan/src/zig/build/zig2.c: In function ‘crypto_blake3_ChunkState_update’:
/home/meghan/src/zig/build/zig2.c:2576184: warning: ‘crypto_blake3_CompressGeneric_compress’ reading 64 bytes from a region of size 32 [-Wstringop-overread]
2576184 |     t27 = crypto_blake3_CompressGeneric_compress(t17, t11, zig_as_u32(64), t4, t26);
        | 
/home/meghan/src/zig/build/zig2.c:2576184: note: referencing argument 2 of type ‘const zig_u32 * const’ {aka ‘const unsigned int * const’}
/home/meghan/src/zig/build/zig2.c:2736956: note: in a call to function ‘crypto_blake3_CompressGeneric_compress’
2736956 | static zig_T_tuple_7b_5b16_5du32_7d_60048 crypto_blake3_CompressGeneric_compress(zig_u32 const a0[zig_const_arr zig_as_u64(8)], zig_u32 const a1[zig_const_arr zig_as_u64(16)], zig_u32 const a2, zig_u64 const a3, zig_u8 const a4) {
        | 
/home/meghan/src/zig/build/zig2.c: In function ‘crypto_blake3_Output_rootOutputBytes’:
/home/meghan/src/zig/build/zig2.c:2576339: warning: ‘crypto_blake3_CompressGeneric_compress’ reading 64 bytes from a region of size 32 [-Wstringop-overread]
2576339 |    t19 = crypto_blake3_CompressGeneric_compress(t9, t11, t13, t18, t17);
        | 
/home/meghan/src/zig/build/zig2.c:2576339: note: referencing argument 2 of type ‘const zig_u32 * const’ {aka ‘const unsigned int * const’}
/home/meghan/src/zig/build/zig2.c:2736956: note: in a call to function ‘crypto_blake3_CompressGeneric_compress’
2736956 | static zig_T_tuple_7b_5b16_5du32_7d_60048 crypto_blake3_CompressGeneric_compress(zig_u32 const a0[zig_const_arr zig_as_u64(8)], zig_u32 const a1[zig_const_arr zig_as_u64(16)], zig_u32 const a2, zig_u64 const a3, zig_u8 const a4) {
        | 
[ 90%] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o
[ 95%] Linking CXX executable zig2
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libffi.so.8, needed by /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_prep_cif@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_sint16@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_float@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_sint32@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_sint64@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_pointer@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_sint8@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_call@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_void@LIBFFI_BASE_8.0'
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so: undefined reference to `ffi_type_double@LIBFFI_BASE_8.0'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/zig2.dir/build.make:975: zig2] Error 1
make[1]: *** [CMakeFiles/Makefile2:170: CMakeFiles/zig2.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Metadata

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

[meghan@nixos:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.82, NixOS, 22.05 (Quokka), 22.05.4498.5cb48ea3c19`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `"nixos-22.05, nixos-hardware"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
[meghan@nixos:~]$ nix-instantiate -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz --eval -E '(import <nixpkgs> {}).lib.version'
"23.05pre-git"
nektro commented 1 year ago
[meghan@nixos:~]$ ldd /nix/store/vzcrnrflmclrh1780f9fh7dr164pisbg-llvm-15.0.7-lib/lib/libLLVM-15.so
    linux-vdso.so.1 (0x00007ffe5b3f1000)
    libffi.so.8 => /nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib/libffi.so.8 (0x00007f339fe54000)
    librt.so.1 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/librt.so.1 (0x00007f339fe4f000)
    libdl.so.2 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libdl.so.2 (0x00007f339fe4a000)
    libz.so.1 => /nix/store/nglx459d8q4p1f1fcn1dv314hldh5h78-zlib-1.2.13/lib/libz.so.1 (0x00007f339fe2c000)
    libncursesw.so.6 => /nix/store/ydqv79hfk4allfsyikdarb9cjrngidlb-ncurses-6.4/lib/libncursesw.so.6 (0x00007f339fdb5000)
    libxml2.so.2 => /nix/store/6pcf2hzn0d4kjddj8v2rzkpr99wwnfx9-libxml2-2.10.3/lib/libxml2.so.2 (0x00007f339fc4e000)
    libstdc++.so.6 => /nix/store/qbgfsaviwqi2p6jr7an1g2754sv3xqhn-gcc-11.3.0-lib/lib/libstdc++.so.6 (0x00007f339fa38000)
    libm.so.6 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libm.so.6 (0x00007f339f958000)
    libgcc_s.so.1 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libgcc_s.so.1 (0x00007f339f93e000)
    libc.so.6 => /nix/store/c35hf8g5b9vksadym9dbjrd6p2y11m8h-glibc-2.35-224/lib/libc.so.6 (0x00007f339f735000)
    /nix/store/cynvahq5hc4g8hg99vajx6p1gw7sqhm7-glibc-2.34-210/lib64/ld-linux-x86-64.so.2 (0x00007f33a7d78000)
[meghan@nixos:~]$ find /nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib/libffi.so.8.1.2
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib/libffi.la
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib/libffi.so
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib/libffi.so.8
/nix/store/jcvxqpa1fiy6m8hxxg8h4a51kids1wcq-libffi-3.4.4/lib64
nektro commented 1 year ago

cc maintainers @ericson2314 @sternenseemann @lovek323 @dtzWill @primeos @rrbutani

trofi commented 1 year ago

Can you check if staging-next is working? Looks very close to the regression fixed in https://github.com/NixOS/nixpkgs/pull/213185 (did not get to master yet).

nektro commented 1 year ago

is there a cache for that branch? using nix-shell with that started building the world

trofi commented 1 year ago

staging-next does have an incomplete cache. If you are accessing at inopportunate time you might catch a few rebuilds. You can pick a specific commit from https://hydra.nixos.org/jobset/nixpkgs/staging-next with most builds done. Most recent it yesterday's 5b5def9

nektro commented 1 year ago

that commit did not fix the issue

nektro commented 1 year ago

edit: scratch that, tried a fresh build. works now 🎉

abathur commented 1 year ago

Closing since it sounds like this was fixed by the merge of #213185. Happy to reopen if I'm mistaken.