如何,何时,在哪里设置libtool的脚本变量? (例如hardcode_minus_L) [英] How, when, where to set script variables of libtool? (e.g. hardcode_minus_L)

查看:170
本文介绍了如何,何时,在哪里设置libtool的脚本变量? (例如hardcode_minus_L)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

长话短说:我从事的工作是相对rpath链接此脚本(即使用自动制作,自动配置,libtool). 问题是二进制可执行文件或so文件中的最后rpath/runpath条目仍然具有绝对路径:

Long story short: I worked on relative rpath linking with this script (that uses automake, autoconf, libtool). The problem is that the final rpath/runpath entry in the binary executable or so file still has the absolute path:

  • 事实证明,默认情况下,libtool的配置如下:
  • it turned out libtool is configured by default like this with hardcode_libdir_flag_spec to include any -L value if it's set in LDFLAGS

唯一的问题仍然是:如何以及在什么时候(正确的方式)设置其他libtool变量,例如hardcode_minus_L. (我已经在网上搜索了,但是找不到任何东西.)

The only question remains: how and at which point (what's the proper way) can I set other libtool variables, like hardcode_minus_L. (I've searched for it on the net, but I couldn't find anything.)

我尝试执行以下操作:

  • 配置之后,用libtool文件(在正确的目录中)的sed替换变量的值:可以工作,但是在调用make时,它将再次覆盖整个libtool文件(已重新生成)
  • after configure is called I tried to replace the value of the variable with sed in libtool file (in the proper directory): it worked but when make is called it overwrote the whole libtool file again (it was regenerated)

请注意,这会影响2个二进制文件,即rpath/runpathobjdump -p的条目:

Note, that 2 binary files are effected by this, entry for rpath/runpath with objdump -p:

  • libcurl.so :RUNPATH /home/user1/lib/rtorrent-0.9.7-1.5.3/lib:$ORIGIN/../lib
  • rtorrent :RUNPATH $ORIGIN/../lib:/home/user1/lib/rtorrent-0.9.7-1.5.3/lib
  • libcurl.so : RUNPATH /home/user1/lib/rtorrent-0.9.7-1.5.3/lib:$ORIGIN/../lib
  • rtorrent : RUNPATH $ORIGIN/../lib:/home/user1/lib/rtorrent-0.9.7-1.5.3/lib

谢谢

推荐答案

事实证明,在configure.ac中修改这些变量非常容易,不需要sed-在摆弄并查看生成的脚本之后.唯一令人困惑的是,这些变量可以应用于 tags在给定的项目中定义.

It turned out it's fairly easy to modify these variables in configure.ac, no need for sed - after fiddling around and taking a look into the generated scripts. The only thing can be confusing that these variables can be applied to tags defined in the given project.

例如要将hardcode_libdir_flag_spec更改为rtorrent项目中的空值(意味着它将破坏编译),您将插入configure.ac:

E.g. to change hardcode_libdir_flag_spec to an empty value in rtorrent project (means it will break compilation), you would insert into configure.ac:

_LT_TAGVAR(hardcode_libdir_flag_spec, )=""
_LT_TAGVAR(hardcode_libdir_flag_spec, CXX)=""
_LT_TAGVAR(hardcode_minus_L, )=yes
_LT_TAGVAR(hardcode_minus_L, CXX)=yes

第二个参数是tagdefault标记(如果为空).

The 2nd parameter is the tag or default tag if it's empty.

这篇关于如何,何时,在哪里设置libtool的脚本变量? (例如hardcode_minus_L)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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