Long story short: I worked on relative rpath linking with this script (that uses automake, autoconf, libtool).
The problem is that the final rpath
/runpath
entry in the binary executable or so
file still has the absolute path:
-L
value if it's set in LDFLAGS
The only question remains: how and at which point (what's the proper way) can I set other libtool variables, like hardcode_minus_L
. (I've searched for it on the net, but I couldn't find anything.)
I tried to do the following:
sed
in libtool
file (in the proper directory): it worked but when make
is called it overwrote the whole libtool
file again (it was regenerated)Note, that 2 binary files are effected by this, entry for rpath
/runpath
with objdump -p
:
RUNPATH /home/user1/lib/rtorrent-0.9.7-1.5.3/lib:$ORIGIN/../lib
RUNPATH $ORIGIN/../lib:/home/user1/lib/rtorrent-0.9.7-1.5.3/lib
Thanks
It turned out it's fairly easy to modify these variables in configure.ac
, no need for sed
- after fiddling around and taking a look into the generated scripts. The only thing can be confusing that these variables can be applied to
tags
defined in the given project.
E.g. to change hardcode_libdir_flag_spec
to an empty value in rtorrent
project (means it will break compilation), you would insert into configure.ac
:
_LT_TAGVAR(hardcode_libdir_flag_spec, )=""
_LT_TAGVAR(hardcode_libdir_flag_spec, CXX)=""
_LT_TAGVAR(hardcode_minus_L, )=yes
_LT_TAGVAR(hardcode_minus_L, CXX)=yes
The 2nd parameter is the tag
or default
tag if it's empty.