rpath(常写作 RPATH)指在类 Unix 系统中,可执行文件或共享库内部记录的一段“运行时库搜索路径”。动态链接器在程序运行时会参考它来查找依赖的共享库(如 .so 文件)。在现代工具链中也常与 RUNPATH 并提。
/ɑːr pæθ/
The program fails because its rpath doesn’t include the directory for the shared library.
程序运行失败,因为它的 rpath 没有包含共享库所在的目录。
When building the application, they set an rpath so the dynamic loader can find the correct versioned libraries without changing the system-wide configuration.
构建应用时,他们设置了 rpath,这样动态加载器无需修改全局系统配置也能找到正确的带版本号库文件。
rpath 来自 runtime path(运行时路径)的缩写:r- 表示 runtime(运行时),path 表示搜索路径。它最初用于解决程序在运行时如何定位共享库的问题,尤其在自定义安装目录或非标准库路径下更常见。
-rpath)及其对生成文件的影响。