自动制作和自定义rpath [英] automake and custom rpath
问题描述
我必须随附一个带有应用程序的第三方库.因为我不想手动设置LD_LIBRARY_PATH
或需要任何包装脚本,所以我想让automake设置自定义rpath
.不幸的是,libtool
有其自己的-rpath
选项,并且将-Wl,-rpath,/foo/bar
添加到LDFLAGS
只会导致
I have to ship a third-party library with an application. Because I don't want to set LD_LIBRARY_PATH
by hand or require any wrapper script I want automake to set a custom rpath
. Unfortunately libtool
has its own -rpath
option and adding -Wl,-rpath,/foo/bar
to LDFLAGS
only results in
g++: unrecognized option '-rpath'
因为libtool
似乎与命令行选项混淆.替代形式-Wl,-rpath -Wl,/foo/bar
也是如此.
because libtool
seems to get confused with the command line options. The same happens with the alternative form -Wl,-rpath -Wl,/foo/bar
.
有没有办法在没有libtool干扰的情况下指定自定义rpath?
Is there any way to specify a custom rpath without libtool interference?
推荐答案
正如您所说,libtool
有其自己的-rpath
选项.您有不想使用它的原因吗?
As you said, libtool
has its own -rpath
option. Any reason you don't want to use it?
% libtool link g++ foo.cc -o foo -rpath /somewhere
libtool: link: g++ foo.cc -o foo -Wl,-rpath -Wl,/somewhere
% readelf -d foo | grep RPATH
0x000000000000000f (RPATH) Library rpath: [/somewhere]
Automake或Libtool手册中的所有示例都不使用-Wl
来指定-rpath
.
None of the examples in the Automake or Libtool manuals use -Wl
to specify -rpath
.
这篇关于自动制作和自定义rpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!