2017年10月18日 星期三

[Linux] 在 gcc 中使用 rpath/rpath-link 指定 shared library 搜尋路徑


You need to add the dynamic library equivalent of -L:
-Wl,-rpath-link,/path/to/lib
This will cause the linker to look for shared libraries in non-standard places, but only for the purpose of verifying the link is correct.
If you want the program to find the library at that location at run-time, then there's a similar option to do that:
-Wl,-rpath,/path/to/lib
But, if your program runs fine without this then you don't need it.


http://ephrain.pixnet.net/blog/post/62918639-%5Blinux%5D-%E5%9C%A8-gcc-%E4%B8%AD%E4%BD%BF%E7%94%A8-rpath-rpath-link-%E6%8C%87%E5%AE%9A-shared-lib

http://buffon.pixnet.net/blog/post/42333430-ld%3A-warning%3A-liba.so%2C-needed-by-...-libb.so%2C-not-found-%28try-

https://zhiwei.li/text/2015/08/16/gcc%E9%93%BE%E6%8E%A5%E9%80%89%E9%A1%B9/

沒有留言:

張貼留言