如何通过相对路径从共享库链接到共享库 [英] how to link to shared lib from shared lib with relative path
问题描述
问题是,我想让插件使用外部库。
我正在研究一个使用外部库在浏览器上渲染3D图形的Firefox插件。无需更改 LD_LIBRARY_PATH
变量。
这些库安装在相对于插件的位置(也是一个共享库),而实际可执行文件(即浏览器)可以位于其他地方。
有些事情你必须知道。
我在Ubuntu上测试它(在Windows版本的插件中没有问题)
我的依赖是OpenSceneGraph库,静态编译会使插件真的很大(如果有另一个,则不是选项)
希望您能帮助我
祝好!
在链接并指定'special'路径时使用rpath选项 $ ORIGIN 。
例子:
$ $ p $ code $ -Wl,-R'$ ORIGIN /../ lib'
以下网站详细介绍如何使用 $ ORIGIN :
http://www.itee.uq.edu.au/~daniel/using_origin/
I'm working on a Firefox plugin that uses external libraries to render 3D graphics on the browser.
The problem is that i want the plugin to use external libraries packed with it without changing the LD_LIBRARY_PATH
variable.
The libraries are installed in a position relative to the plugin (a shared library too), while the actual executable (i.e. the browser) can be located somewhere entirely else.
Some things that you must know. I'm testing it on Ubuntu (no problem at Windows version of the plugin) My dependencies are OpenSceneGraph libraries and static compilation will make the plugin really big (not an option if there is another one)
Hope you can help me
Best regards.
Use the rpath option when linking and specify the 'special' path $ORIGIN.
Example:
-Wl,-R,'$ORIGIN/../lib'
Here's a site that elaborates on using $ORIGIN: http://www.itee.uq.edu.au/~daniel/using_origin/
这篇关于如何通过相对路径从共享库链接到共享库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!