[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Accounting for -rpath when libtool isn't helping
From: |
Roumen Petrov |
Subject: |
Re: Accounting for -rpath when libtool isn't helping |
Date: |
Fri, 15 Feb 2019 21:07:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.4 |
Hi Paul,
Paul "LeoNerd" Evans wrote:
[SNIP]
Alternatively, am I looking at this from the wrong direction? Maybe the
problem is that the exporting library isn't providing -Wl,-rpath in
its .pc file, to assist anyone else who wasn't using libtool to link it
(such as is the case here).
No , I don't think that this is valuable.
With that in mind, I now generate those if required, in the little
shell fragment I use to create the .pc file:
#!/bin/sh
LIBS='-L${libdir} -ltickit'
CFLAGS='-I${includedir}'
case "$LIBDIR" in
/usr/lib) ;;
/usr/local/lib) ;;
*)
LIBS="$LIBS -Wl,-rpath -Wl,$LIBDIR"
;;
esac
cat <<EOF
libdir=$LIBDIR
includedir=$INCDIR
Name: tickit
Description: Terminal Interface Construction KIT
Version: 0.2
Libs: $LIBS
Cflags: $CFLAGS
EOF
Like you perl (first email) and shell (above) scripts libtool do similar
to decide when to add "runpath" linker flag. Libtool parses
/etc/ld.so.conf and "build-in default paths" and if a library path is
not in list adds "runpath" flag.
On most platform you control this via variable
lt_cv_sys_lib_dlsearch_path_spec. Pattern *_cv_* mean that this is a
"autoconf cache variable" and "lt" is custom namespace prefix.
Add $HOME/lib to list to avoid -rpath flag.
For some autoconf builds with use of libtool you could force -rpath if
needed - add those options to LDFLAGS ( see ./configure --help) .
Regards,
Roumen Petrov