On 10.05.21 13:52, Marc Glisse wrote:
On Mon, 10 May 2021, aotto wrote:
I have an application with the following setup:
#1 executable cct build with -rpath /my/special/dir
#2 /my/special/dir has shared library libmyspecial.so as
LOCAL-SOFT-LINK to libmyspecial.so.4.0
problem dlopen /my/special/dir/libmyspecial.so fails with
libmyspecial.so.4.0 not found
start LD_DEBUG=all cct shows that -rpath is NOT used :
7205: file=libmyspecial.so.4.0 [0]; needed by
/my/special/dir/libtclreadline.so [0]
If libmyspecial.so.4.0 is used by libtclreadline.so, why not specify
-rpath when building libtclreadline.so?
Could you clarify who calls dlopen on what?
the libmyspecial is an automake file and libtool/automake has special
-rpath settings, the most important is that only
ONE -rpath is allowed and the one -rpath is set by automake.
BUT even with an -rpath set looking into a shared library (objdump
-p...) display no DT_RUNPATH section at all.
My assumption is that -rpath for a shared library is ONLY used at
compile-time.
I personally have only ONE solution for this problem and this is the
LD_LIBRARY_PATH environment variable.
The problem is that after relocation of the software into OTHER
directory the software is broken
because LD_LIBRARY_PATH is wrong.
I personally thing this it is an BUG that the softlink is NOT resolved
because the PATH to the shared library directory is
known (dlopen called with absolut path) and ONLY the path resolution in
ld.so fails for the soft-link because NOT USING the already
known absolute path.
mfg