nix-patchtools
nix-patchtools copied to clipboard
Fails when failing to find library that doesn't need to be found
autopatchelf can fail like:
Auto patching ELF binary: build-tools/30.0.3/bcc_compat
No package found that provides library: libbcinfo.so
despite the library NOT being "not found" (the original RPATH contained a useful local reference):
$ ldd build-tools/30.0.3/bcc_compat
linux-vdso.so.1 (0x00007ffdd6bdc000)
libbcc.so => /home/adroit/android-sdk/build-tools/30.0.3/lib64/libbcc.so (0x00007f2184019000)
libbcinfo.so => /home/adroit/android-sdk/build-tools/30.0.3/lib64/libbcinfo.so (0x00007f2183fb8000)
libLLVM_android.so => /home/adroit/android-sdk/build-tools/30.0.3/lib64/libLLVM_android.so (0x00007f2182100000)
libc++.so => /home/adroit/android-sdk/build-tools/30.0.3/lib64/libc++.so (0x00007f218201a000)
libdl.so.2 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libdl.so.2 (0x00007f2182015000)
libpthread.so.0 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libpthread.so.0 (0x00007f2181ff2000)
libm.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libm.so.6 (0x00007f2181eb1000)
librt.so.1 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/librt.so.1 (0x00007f2181ea7000)
libncurses.so.5 => not found
libtinfo.so.5 => not found
libgcc_s.so.1 => not found
libc.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libc.so.6 (0x00007f2181ce8000)
/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2 (0x00007f218409a000)
libncurses.so.5 => not found
libtinfo.so.5 => not found
libgcc_s.so.1 => not found
libncurses.so.5 => not found
libtinfo.so.5 => not found
libgcc_s.so.1 => not found
libncurses.so.5 => not found
libtinfo.so.5 => not found
libgcc_s.so.1 => not found
libgcc_s.so.1 => not found
This should not cause failure..
Looking at the script, it seems the use of --print-needed is to blame:
$ patchelf --print-needed build-tools/30.0.3/bcc_compat
libbcc.so
libbcinfo.so
libLLVM_android.so
libc++.so
libdl.so.2
libpthread.so.0
libm.so.6
librt.so.1
libncurses.so.5
libtinfo.so.5
libgcc_s.so.1
libc.so.6
Not sure why it lists less than all specified by ldd
, but more than just the missing ones.
Something like this could be used instead:
ldd build-tools/30.0.3/bcc_compat | grep "not found" | cut -d ' ' -f 1 | tr -d '\t'
which lists only the missing libraries:
$ ldd build-tools/30.0.3/bcc_compat | grep "not found" | cut -d ' ' -f 1 | tr -d '\t'
libncurses.so.5
libtinfo.so.5
libgcc_s.so.1
libncurses.so.5
libtinfo.so.5
libgcc_s.so.1
libncurses.so.5
libtinfo.so.5
libgcc_s.so.1
libncurses.so.5
libtinfo.so.5
libgcc_s.so.1
libgcc_s.so.1