代码之家  ›  专栏  ›  技术社区  ›  Krisztian

如何、何时、何处设置libtool的脚本变量?(例如硬代码-U-L)

  •  0
  • Krisztian  · 技术社区  · 7 年前

    relative rpath linking 具有 this script (即 uses 问题是决赛 rpath / runpath 二进制可执行文件或 so 文件仍然具有绝对路径:

    hardcode_minus_L (我在网上找过,但什么也没找到。)

    • configure 我试图用 sed 在里面 libtool make 被称为是对整体的过度书写

    注意,2个二进制文件受此影响 rpath路径 / 运行路径 具有 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

    谢谢

    2 回复  |  直到 7 年前
        1
  •  1
  •   Christian Feld    7 年前

    我不知道是否修改生成的 libtool 脚本是解决问题的最佳方法。但是如果你这样做,你需要通过执行 sed AC_CONFIG_COMMANDS .

    这个 脚本在配置期间生成。作为配置命令的状态( AC\u CONFIG\u命令 https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Commands ) .

    config.status: executing libtool commands
    

    您可以通过添加另一个文件来修改此生成的文件 AC\u CONFIG\u命令 . 我们使用以下命令来更改 prefer_static_libs

    AC_CONFIG_COMMANDS([libtool-fix-linker-preference],                                                                                                                      
        [${SED} -e '1,/prefer_static_libs=/ s/prefer_static_libs=.*$/prefer_static_libs=yes/' \
         libtool > libtool.fix && mv libtool.fix libtool])
    

    AC\u CONFIG\u命令 LT_INIT . 配置/配置。状态报告执行:

    config.status: executing libtool commands
    config.status: executing libtool-fix-linker-preference commands
    

    基督教的

        2
  •  0
  •   Krisztian    7 年前

    configure.ac ,无需 sed tags

    hardcode_libdir_flag_spec 到中的空值 rtorrent 项目(意味着它将中断编译),您将插入到 配置.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
    

    第二个参数是 tag default 标记是否为空。