在ubuntu16下使用chrpath。
安装:
sudo apt install chrpath
查看可用选项:
wmz@ubuntu:~$ chrpath --help
Usage: chrpath [-v|-d|-c|-r <path>] <program> [<program> ...]
-v|--version Display program version number
-d|--delete Delete current rpath/runpath setting
-c|--convert Convert rpath to runpath
-r <path>|--replace <path> Replace current rpath/runpath setting
with the path given
-l|--list List the current rpath/runpath (default)
-k|--keepgoing Do not fail on first error
-h|--help Show this usage information.
查看版本:
wmz@ubuntu:~$ chrpath -v
chrpath version 0.16
查看已经编译好的程序的依赖路径:
build$ chrpath -l demo
demo: RPATH=/mnt/hgfs/vmsharefolders/libtorch/lib:/home/wmz/Desktop/mypractice/pytorch-demo/../libs
修改依赖库路径:
build$ chrpath -r ../../libs demo
demo: RPATH=../../libs
demo: new RPATH: ../../libs
注意中间一行是旧路径,最后一行是新路径,本来这两行应该是不一样的,因为前面我已经执行过一遍了,这里再执行一遍只是为了笔记说明。
最后建议:一般不要去用这个工具,不然遇到问题都不知道怎么解决。