PDA

View Full Version : Building my CLI App statically and adding external dylib.



TCB13
20th November 2011, 18:17
Hi everyone,

I've been doing some interesting thing in some personal projects with QT. I'm using the software in OSX and usually I compile the final versions against a static version of QT using a shell script that do this:



cd "project folder...";
PATH=/Users/TCB13/(...)/qt-source/bin:$PATH; --> Path to my static QT.
export PATH;
qmake -config release;
make;
make clean;


And everything works fine in another machine with OSX without QT installed. The problem is that lately I've been playing with an external dynamic library I downloaded and and can get it working in the other computer.

I've included the dylib in my .pro file like this: (I've a copy of the dylib in the project folder)



#macx: LIBS += -L$$PWD/ -lwpsapi

#INCLUDEPATH += $$PWD/
#DEPENDPATH += $$PWD/


And when I compile it "statically" and run it on the other computer I get:



dyld: Library not loaded: @executable_path/libwpsapi.dylib
Referenced from: /Users/TCB13/Desktop/dude111
Reason: image not found
Trace/BPT trap: 5


I noticed that the size of my compiled binary is the same with or without including the dylib so, I googled how to include and external lib and some people are saying that I need to add "CONFIG += static" to my .pro file. I did it and the size of the file increased but I still got the same error.

Thanks! ;)