I don't have the same binary you have but I made a little test and it
seems that patchelf
can work here. I have a hello
binary compiled
with -Wl,-rpath=/home/ja/c/hello-puts/make/lib
and libtest.so
as a
dependency:
$ ldd hello
linux-vdso.so.1 (0x00007ffedb4f0000)
libtest.so => /home/ja/c/hello-puts/make/lib/libtest.so (0x00007f04a2437000)
libc.so.6 => /lib64/libc.so.6 (0x00007f04a200f000)
/lib64/ld-linux-x86-64.so.2 (0x0000564a42e36000)
I run patchelf
with --make-needed-absolute
using patchelf
from https://github.com/dezgeg/patchelf/:
$ patchelf --make-needed-absolute hello
$ ldd hello
linux-vdso.so.1 (0x00007fff9baa3000)
/home/ja/c/hello-puts/make/lib/libtest.so (0x00007f81bd0e2000)
libc.so.6 => /lib64/libc.so.6 (0x00007f81bccba000)
/lib64/ld-linux-x86-64.so.2 (0x0000556714bb5000)
I think that's what you have. I copied hello
to other machine and:
$ ldd ./hello
linux-vdso.so.1 => (0x00007fff92e7d000)
/home/ja/c/hello-puts/make/lib/libtest.so => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff381c9b000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff382065000)
I first removed a needed libtest.so
dependency:
$ patchelf --remove-needed /home/ja/c/hello-puts/make/lib/libtest.so hello
$ ldd hello
linux-vdso.so.1 => (0x00007ffdcedfb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f60705c5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f607098f000)
I tried to run hello
, it started but due to lazy binding done by the
interpreter only the first line of the expected output was shown:
$ ./hello
hello world
./hello: symbol lookup error: ./hello: undefined symbol: foo
I added libtest.so
again but without an absolute path:
$ patchelf --add-needed libtest.so hello
$ ldd hello
linux-vdso.so.1 => (0x00007ffda155c000)
libtest.so => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffbdb8c3000)
/lib64/ld-linux-x86-64.so.2 (0x00007ffbdbc8d000)
I copied libtest.so
to $PWD
and was able to start hello
:
$ LD_LIBRARY_PATH=. ./hello
hello world
inside foo()
fakeroot
, not sure if it will work, if not, talk with the sysadmin.patchelf
could help?