ld编译选项-rpath和-rpath-link的区别
如资料1所述:
The difference between
-rpath
and-rpath-link
is that directories specified by-rpath
options are included in the executable and used at runtime, whereas the-rpath-link
option is only effective at link time.
- -rpath-link 只影响静态编译的链接阶段
- -rpath 还会影响动态运行阶段。它会把路径写到ELF文件的DT_RPATH标记里面,从而影响动态链接器ld.so寻找共享库的过程,但是ld.so的manual不建议这么做。