-rpath/-rpath- link
来源:互联网 发布:未来软件4.8 编辑:程序博客网 时间:2024/06/16 07:01
-rpath/-rpath- link其实都是ld的option,不是gcc的。
gcc只是一个wrapper,将preprocessor, assemble, link三者结合了起来。
-rpath <dir>的作用是手动将一个目录强行指定成一个.so文件的搜索目录,他的优先级在LD_LIBRARY_PATH和/etc /ld.so.conf...这些地方定义的.so文件搜索目录之上。
由于这个目录是由程序的开发人员在编译的时候指定的,所以将来这个程序到了其他机器 上运行的时候,这个目录是不能修改的。
-rpath-link和-rpath类似,只不过-rpath-link <dir>指定的是该程序需要的某个动态链接库,如果还需要其他的动态链接库(就象我们这里libalp_media.so还需要其他 的.so一样)的时候,到哪个/哪些目录下去查找需要的.so。而且,和-rpath不同,在-rpath-link中定义的目录,有可能在ldd <exec>的输出中看不见,因为这里定义的目录不是该执行程序本身所需要的。
清楚了这两个option的含义之后, 来看用法,要在gcc的命令行中直接使用这两个option,必须遵循语法:-Wl,......。比 如:-Wl,--rpath-link /opt/alp/lib。
-Wl就是告诉gcc,后面的内容是传递给linker的option。如果直接使用ld的话,就不需要-Wl,了。所以,上 面我们的编译命令就变成这样,就OK了:
阅读全文
0 0
- -rpath/-rpath- link
- LD的-rpath,-rpath-link
- rpath-link和rpath使用
- -L、-rpath和-rpath-link的区别
- 错误:try using -rpath or -rpath-link
- GCC链接选项-L,-rpath-link和-rpath
- gcc的 -L -I -l -rpath -rpath-link
- GCC链接选项-L,-rpath-link和-rpath
- GCC链接选项-L,-rpath-link和-rpath
- 【PE】链接选项-L,-l,-rpath,-rpath-link用法分析
- [Makefile]warning: needed by not found (try using -rpath or -rpath-link)错误处理
- warning: needed by not found (try using -rpath or -rpath-link)错误处理
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- 动态库的链接和链接选项-L,-rpath-link,-rpath
- Python中Swithch Case语法实现
- 那些漂亮的桌面
- 【原】Linux 终端分屏工具 tmux 配…
- 【原】Ubuntu Linux 下中文latex字…
- 华丽丽的未来分界线!
- -rpath/-rpath- link
- 2014年9月17日
- [bigdata-097]搭建maven私服 nexus
- poi解析Excel2007
- 纳粹阅兵
- 【转】P档和全自动档有何区别?
- [转]Cygwin, sshd and Windows 7
- preceding-sibling::*[1]
- 【原】Win7 下配置安装Cygwin sshd…