-
-
Notifications
You must be signed in to change notification settings - Fork 503
Open
Labels
Description
Describe the bug
Even after doing --add-rpath
, a library is still not found.
Steps To Reproduce
I have an executable that cannot find libicu:
$ ldd test-orig | grep icu
libicuuc.so.76 => not found
libicudata.so.76 => not found
When I use patchelf to amend the rpath:
$ patchelf --debug --add-rpath /nix/store/i4lj3w4yd9x9jbi7a1xhjqsr7bg8jq7p-icu4c-76.1/lib build/test
patching ELF file 'build/test'
new rpath is '$ORIGIN:$ORIGIN/system:/nix/store/vi5r10g0cflb740c9a8bj1z18s0zvzh6-onlyoffice-core-D>
rpath is too long, resizing...
replacing section '.dynstr' with size 3463
this is an executable
using replaced section '.dynstr'
last replaced is 5
looking at section '.interp'
replacing section '.interp' which is in the way
looking at section '.hash'
replacing section '.hash' which is in the way
looking at section '.gnu.hash'
replacing section '.gnu.hash' which is in the way
looking at section '.dynsym'
replacing section '.dynsym' which is in the way
looking at section '.dynstr'
first reserved offset/addr is 0x2aa8/0x402aa8
first page is 0x400000
needed space is 11336
needed space is 11392
needed pages is 1
clearing first 14112 bytes
rewriting section '.dynstr' from offset 0x2ec0 (size 3048) to offset 0x388 (size 3463)
rewriting section '.dynsym' from offset 0x1ca8 (size 4632) to offset 0x1110 (size 4632)
rewriting section '.gnu.hash' from offset 0x1c88 (size 28) to offset 0x2328 (size 28)
rewriting section '.hash' from offset 0x13a8 (size 2272) to offset 0x2348 (size 2272)
rewriting section '.interp' from offset 0x1350 (size 83) to offset 0x2c28 (size 83)
rewriting symbol table section 2
rewriting symbol table section 29
writing build/test
... the section indeed appears to be added:
$ strings test | grep icu
$ORIGIN:$ORIGIN/system:/nix/store/pz233pakxb51na3vnwpd4cni59isbqin-onlyoffice-core-DesktopEditor-doctrenderer-test-js_internal/lib:/nix/store/zp5blp3sqmmxpfr0ig6insybvx7r6j6n-onlyoffice-core-DesktopEditor-doctrenderer/lib:/nix/store/cg9s562sa33k78m63njfn1rw47dp9z0i-glibc-2.40-66/lib:/nix/store/7c0v0kbrrdc2cqgisi78jdqxn73n3401-gcc-14.2.1.20250322-lib/lib:/nix/store/i4lj3w4yd9x9jbi7a1xhjqsr7bg8jq7p-icu4c-76.1/lib
... but the library is still not found:
$ ldd test | grep icu
libicuuc.so.76 => not found
libicudata.so.76 => not found
(/nix/store/i4lj3w4yd9x9jbi7a1xhjqsr7bg8jq7p-icu4c-76.1/lib
definitely contains libicuuc.so.76
and libicudata.so.76
)
Expected behavior
for ldd to find the library
patchelf --version
output
patchelf 0.15.0