可执行文件的rpath指定一个或多个目录,其中在运行时查找共享对象.
我的问题是 – 共享对象文件本身也有静态编译的rpath?
./example: /opt/swt/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./mylib.so)
这个错误告诉我实际的库本身–mylib.so,有一个静态编译的rpath.
我的理解是rpath只适用于可执行文件,而不是共享对象.那么rpath也适用于共享对象吗?
解决方法
do shared object files themselves also have statically-compiled
rpaths
它们可能(或可能不)取决于它们是否与-Wl,-rpath = …选项相关联.
This error indicates to me that the actually library itself –
mylib.so
,has an statically compiledrpath
.
错误消息根本没有说明.你在哪里得到这个想法?
如果您想知道mylib.so是否具有DT_RPATH,请执行以下操作:
readelf -d mylib.so | grep 'R.*PATH' # could also have RUNPATH
My understanding was that
rpath
only applied to executables,not shared objects. So doesrpath
also apply to shared objects?
您的理解不正确,RPATH(和RUNPATH)也适用于共享对象.