-rpath ORIGIN_C/C++_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > C/C++ > -rpath ORIGIN

-rpath ORIGIN

 2012/10/15 10:40:47  zealotds  程序员俱乐部  我要评论(0)
  • 摘要:Thisparameterissignificantifyouneedtobuildabinarythatdependsonotherdynamiclibrary."rpath"meansruntimepath(toloaddependentdynamiclibrary).Andtheveryusefulvariablethatwefrequentlyusedis"$ORIGIN"whichmeansthepathwhereyour(link)targetbinaryisloaded
  • 标签:
This parameter is significant if you need to build a binary that depends on other dynamic library. "rpath" means runtime path (to load dependent dynamic library).

And the very useful variable that we frequently used is "$ORIGIN" which means the path where your (link) target binary is loaded.

Assuming your target lib is libb.so and it depends on liba.so and their deployment structure is like:


<install_root>
|
libb.so
|
<sub_dir>
  |
  liba.so


You should supply below argument to your linker(i.e.g++):

-rpath,'$$ORIGIN/<sub_dir>'
# the above double '$' is necessary if it is written 
# in makefile (for escape purpose).


For more information, check 'man ld'
  • 相关文章
发表评论
用户名: 匿名