Question

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).

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.

Also, I'd link to know how to do this on a linux system - is it possible?

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top