Re: Accounting for -rpath when libtool isn't helping

2019-02-15 Thread Roumen Petrov

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 <

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


___
https://lists.gnu.org/mailman/listinfo/libtool


Re: Accounting for -rpath when libtool isn't helping

2019-02-15 Thread Paul "LeoNerd" Evans
On Thu, 14 Feb 2019 23:21:26 +
"Paul \"LeoNerd\" Evans"  wrote:

> My earlier suggested approach of trying to hunt down the .la files and
> generate/append extra -Wl,-rpath arguments appears to be working
> reliably though, so it may be that's the best approach. It does feel
> rather fragile however, as I'm second-guessing around what libtool
> would do.

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).

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