In my qmake .pro file I add my desired dynamic library to LIB which allows for compilation but doesn't link to the library in the compiled application (i.e. I get a library not found error at run time).
在我的qmake .pro文件中,我将我想要的动态库添加到LIB,它允许编译但不链接到已编译应用程序中的库(即我在运行时遇到库未找到错误)。
The problem is that I have the library in my build directory, not in the system directory (i.e. /usr/lib). But, I want to generate a OSX app that doesn't touch the system outside of the .app folder.
问题是我的构建目录中有库,而不是系统目录(即/ usr / lib)。但是,我想生成一个OSX应用程序,它不会触及.app文件夹之外的系统。
Also, I'd link to know how to do this on a linux system - is it possible?
另外,我想知道如何在Linux系统上执行此操作 - 是否可能?
My question is related to the Qmake generating a proper .app question but differs in that the link that answers that question doesn't answer my question.
我的问题与Qmake生成一个正确的.app问题有关,但不同之处在于回答该问题的链接不能回答我的问题。
1 个解决方案
#1
Put a wrapper script round your program so the current working directory is in the dynamic library search path:
在程序周围放置一个包装器脚本,以便当前工作目录位于动态库搜索路径中:
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
./program
#1
Put a wrapper script round your program so the current working directory is in the dynamic library search path:
在程序周围放置一个包装器脚本,以便当前工作目录位于动态库搜索路径中:
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
./program