This page表示ld.so
中的图书馆搜索顺序:
Unless loading object has RUNPATH: RPATH of the loading object, then the RPATH of its loader (unless it has a RUNPATH), ..., until the end of the chain, which is either the executable or an object loaded by dlopen Unless executable has RUNPATH: RPATH of the executable LD_LIBRARY_PATH RUNPATH of the loading object ld.so.cache default dirs
然后建议:
发布二进制文件时,请使用RPATH而不是RUNPATH,或者确保
所以,使用RPATH
和RUNPATH
是不好的,因为RUNPATH
抵消了RPATH
,所以间接动态加载不能像预期的那样工作?但为什么RPATH
人被否决,而RUNPATH
人呢?
有人能解释一下情况吗?