自动制作和自定义rpath [英] automake and custom rpath

查看:82
本文介绍了自动制作和自定义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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆