简体   繁体   English

在编译程序时防止autotools设置rpath

[英]Prevent autotools from setting rpath when compiling my program

I'm working on an example autotools project which builds a shared library and a program. 我正在开发一个示例autotools项目,它构建了一个共享库和一个程序。 The program should link to the shared library. 该程序应链接到共享库。 But when I build the program libtool will set the rpath like this: 但是当我构建程序时,libtool会像这样设置rpath

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 ). 根据Debian Wiki,libtool不应该在库处于默认搜索路径( libtool的角色 )时设置rpath

According to this site /usr/local/lib should be in the default search path of the linker. 根据这个站点 /usr/local/lib应该在链接器的默认搜索路径中。

The library and the program are build by the same autotools project, so the library is not installed when the program is build. 库和程序由同一个autotools项目构建,因此在构建程序时不会安装库。

Does anybody have an idea why libtool sets the rpath anyway? 有没有人知道为什么libtool会设置rpath呢?

  • with readelf readelf -d libfftw3_mpi.so you can check if your lib contains such a attribute in the dynamic section. 使用readelf readelf -d libfftw3_mpi.so,您可以检查您的lib是否在动态部分中包含此类属性。

  • with export LD_DEBUG=libs you can debug the search path used to find your libs 使用export LD_DEBUG = libs,您可以调试用于查找lib的搜索路径

  • with chrpath -r the rpath can be changed 使用chrpath -r可以更改rpath

As answered in https://stackoverflow.com/a/33520976/4379130 by @bonoparte 正如@bonoparte在https://stackoverflow.com/a/33520976/4379130中所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM