Prevent autotools from setting rpath when compiling my program

787 views Asked by At

I'm working on an example autotools project which builds a shared library and a program. The program should link to the shared library. But when I build the program libtool will set the rpath like this:

RPATH=/usr/local/lib

which I don't want.

According to the Debian Wiki libtool isn't supposed to set the rpath when the library is in the default search path (libtool's role).

According to this site /usr/local/lib should be in the default search path of the linker.

The library and the program are build by the same autotools project, so the library is not installed when the program is build.

Does anybody have an idea why libtool sets the rpath anyway?

1

There are 1 answers

0
John Greene On
  • with readelf readelf -d libfftw3_mpi.so you can check if your lib contains such a attribute in the dynamic section.

  • with export LD_DEBUG=libs you can debug the search path used to find your libs

  • with chrpath -r the rpath can be changed

As answered in https://stackoverflow.com/a/33520976/4379130 by @bonoparte