[Bug 1737608] Re: RPATH no longer respected for indirect dependencies
Olivier BARTHELEMY
1737608 at bugs.launchpad.net
Mon Aug 6 11:59:02 UTC 2018
I seem to have a similar issue since I started testing Ubuntu 18.
I have myapp -> mylib -> libQt5Gui.so -> libpng.so -> libz.so.1
The qt lib has an explicit link on the command line.
The 2 last libraries can be found in the same folder, so i used to add -rpath-link to that folder to make them found at link time without storing that path in the binaries (gcc 4.8 / ld 2.24).
With gcc 7 / ld 2.30 of ubuntu 18.04, libpng seems found, but libz cannot be resolved.
LD_DEBUG=libs shows that a libz from the system is found at some point during the build, but that's not the one i want, and the linker does not seem happy with it anyways.
Here too, adding that folder to LD_LIBRARY_PATH makes the link succeed.
Has there been any search on the issue?
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1737608
Title:
RPATH no longer respected for indirect dependencies
Status in glibc package in Ubuntu:
New
Bug description:
Regression from Ubuntu 16.04 to Ubuntu 17.10.
I am building a binary with a hard-coded RUNPATH, pointing to the
location of some vendor-supplied shared libraries.
$ readelf -d /home/steve/src/krx/tests/krx.test | grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [../library]
On Ubuntu 16.04 the RUNPATH allowed us to locate the libraries.
$ ldd ./krx.test
...
libinisafeNet.so => ../library/libinisafeNet.so (0x00007f35c7754000)
libiniCore.so => ../library/libiniCore.so (0x00007f35c5bea000)
libiniPKI.so => ../library/libiniPKI.so (0x00007f35c5952000)
libiniCrypto.so => ../library/libiniCrypto.so (0x00007f35c56e6000)
On Ubuntu 17.10 it no longer works
$ ldd ./krx.test
...
libinisafeNet.so => ../library/libinisafeNet.so (0x00007fb4acc38000)
libiniCore.so => not found
libiniPKI.so => not found
libiniCrypto.so => not found
Note that setting LD_LIBRARY_PATH does allow the libraries to be found
$ export LD_LIBRARY_PATH=../library
$ ldd ./krx.test
...
libinisafeNet.so => ../library/libinisafeNet.so (0x00007fa787659000)
libiniCore.so => ../library/libiniCore.so (0x00007fa785a86000)
libiniPKI.so => ../library/libiniPKI.so (0x00007fa7857ee000)
libiniCrypto.so => ../library/libiniCrypto.so (0x00007fa785582000)
-------------------
>> LD_DEBUG for Ubuntu 16.04 <<
I set LD_DEBUG=all and ran ldd against my binary.
Here is an excerpt for libiniCore.so:
30438: file=libiniCore.so [0]; needed by ../library/libinisafeNet.so [0]
30438: find library=libiniCore.so [0]; searching
30438: search path=../library/tls/x86_64:../library/tls:../library/x86_64:../library (RPATH from file ./krx.test)
30438: trying file=../library/tls/x86_64/libiniCore.so
30438: trying file=../library/tls/libiniCore.so
30438: trying file=../library/x86_64/libiniCore.so
30438: trying file=../library/libiniCore.so
The library is successfully located, and as can be seen from the search path section, it is using RPATH from file ./krx.test.
-------------------
>> LD_DEBUG for Ubuntu 17.10 <<
I set LD_DEBUG=all and ran ldd against my binary.
Here is an excerpt for libiniCore.so: (it now uses the system search
path, not the krx.test RPATH)
20027: file=libiniCore.so [0]; needed by ../library/libinisafeNet.so [0]
20027: find library=libiniCore.so [0]; searching
20027: search cache=/etc/ld.so.cache
20027: search path=/lib/x86_64-linux-gnu/tls/haswell/x86_64:/lib/x86_64-linux-gnu/tls/haswell:/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/haswell/x86_64:/lib/x86_64-linux-gnu/haswell:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/tls/haswell/x86_64:/usr/lib/x86_64-linux-gnu/tls/haswell:/usr/lib/x86_64-linux-gnu/tls/x86_64:/usr/lib/x86_64-linux-gnu/tls:/usr/lib/x86_64-linux-gnu/haswell/x86_64:/usr/lib/x86_64-linux-gnu/haswell:/usr/lib/x86_64-linux-gnu/x86_64:/usr/lib/x86_64-linux-gnu:/lib/tls/haswell/x86_64:/lib/tls/haswell:/lib/tls/x86_64:/lib/tls:/lib/haswell/x86_64:/lib/haswell:/lib/x86_64:/lib:/usr/lib/tls/haswell/x86_64:/usr/lib/tls/haswell:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/haswell/x86_64:/usr/lib/haswell:/usr/lib/x86_64:/usr/lib (system search path)
20027: trying file=/lib/x86_64-linux-gnu/tls/haswell/x86_64/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/tls/haswell/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/tls/x86_64/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/tls/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/haswell/x86_64/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/haswell/libiniCore.so
20027: trying file=/lib/x86_64-linux-gnu/x86_64/libiniCore.so
... ...
20027: trying file=/lib/x86_64/libiniCore.so
20027: trying file=/lib/libiniCore.so
20027: trying file=/usr/lib/tls/haswell/x86_64/libiniCore.so
20027: trying file=/usr/lib/tls/haswell/libiniCore.so
20027: trying file=/usr/lib/tls/x86_64/libiniCore.so
20027: trying file=/usr/lib/tls/libiniCore.so
20027: trying file=/usr/lib/haswell/x86_64/libiniCore.so
20027: trying file=/usr/lib/haswell/libiniCore.so
20027: trying file=/usr/lib/x86_64/libiniCore.so
20027: trying file=/usr/lib/libiniCore.so
So it seems the behaviour of ld has changed, and since it is an
indirect dependency (krx.test --> libinisafeNet.so --> libiniCore.so)
the RPATH for krx.test is no longer used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1737608/+subscriptions
More information about the foundations-bugs
mailing list