与distutils共享库依赖

与distutils共享库依赖,第1张

与distutils共享库依赖

您可以使用链接器存储路径来搜索输出二进制文件,因此不需要LD_LIBRARY_PATH。一些例子:

# Will link fine but at run-time LD_LIBRARY_PATH would be requiredgcc -o blah blah.o -lpcap -L/opt/csw/lib# Without LD_LIBRARY_PATH=/opt/csw/lib it will fail to link, but# it wouldn't be needed at run-timegcc -o blah blah.o -lpcap -Wl,-R/opt/csw/lib# LD_LIBRARY_PATH not needed at link or run-timegcc -o blah blah.o -lpcap -Wl,-{L,R}/opt/csw/lib# This makes it possible to use relative paths; run `readelf -d binary_name`# and you'll see '$ORIGIN/../lib/' in RPATH.  This plus `-zorigin` make it look# relative to the binary for libraries at run-timegcc -o blah blah.o -lsomelib -L/whatever/path/floats/your/boat -Wl,-R'$ORIGIN/../lib/' -Wl,-zorigin

..其中:

  • 给出的路径
    -L
    链接时使用
  • 给定的路径
    -R
    运行时使用


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5650242.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存