嵌入共享库的绝对路径 [英] embedding absolute path for shared libraries

查看:91
本文介绍了嵌入共享库的绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用供应商提供的交叉编译工具链(显然是OpenEmbedded衍生产品),我无法将绝对路径嵌入到第三方(开放源代码,内部编译)库中。使用以下gcc命令行:

Using a vendor provided cross-compiling toolchain (apparently an OpenEmbedded derivative), I'm unable to embed the absolute path to third-party (open source, compiled in house)libraries. With the following gcc command line:

arm-linux-gcc test_connect_send.o gprs_connect.o \
    /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libgprs_stuff.so \
    /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libpower_supply_stuff.so \
    /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libgsm_stuff.so \
    /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libtcp_stuff.so \
    /package/host/aspl.es/vortex-1.1.0/lib/libvortex-1.1.so \
    /package/host/aspl.es/axl-0.5.6/lib/libaxl.so.0  -o test_connect_send

objdump说:

Dynamic Section:
  NEEDED      /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libgprs_stuff.so
  NEEDED      /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libpower_supply_stuff.so
  NEEDED      /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libgsm_stuff.so
  NEEDED      /package/host/myvendor.com/API-R-2.0.0/Release/Libraries/libtcp_stuff.so
  NEEDED      libvortex-1.1.so.0
  NEEDED      libaxl.so.0
  NEEDED      libgcc_s.so.1
  NEEDED      libc.so.6

请注意供应商的库确实有其完整路径,而aspl没有。另外,请注意嵌入的名称与我在命令行上指定的名称有何不同。我想知道为什么(谁弄乱了我的路径)以及如何解决它。

Notice how my vendor's libraries do have their full path, while aspl's don't. Also, notice how the name embedded is different from the one I specified on the command line. I'd like to know why (who is messing with my paths), and how to solve it.

ps:我了解RPATH,这不是我的答案我正在寻找

p.s.: I know about RPATH, that's not the answer I'm looking for

推荐答案

我的猜测是供应商提供的库会将SONAME设置为完整的安装路径。

My guess would be that the vendor supplied libs set the SONAME to the full installed path.

这篇关于嵌入共享库的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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