PDA

View Full Version : Dynamic linking on Mac OS X



Vnuce
18th October 2009, 23:12
Hi,
although I am not a newbie concerning Qt, I'm a newbie on this forum and as a Mac user. :)

I've been trying to run my project (originally developed on Linux), consisted of a couple of shared libraries and a couple of executables on OS X, but the linking fails.
I (sort of) understood that the libraries are supposed to be in the app bundle, in the Frameworks dir, but I didn't understand how to achieve that.

Any friendly Mac-using Qt developers around here could give me a hint or two?

Thanks.

axeljaeger
19th October 2009, 08:23
Have you tried the Qt tool macdeployqt? It will bundle all necessary libraries and frameworks into your application bundle.

Vnuce
19th October 2009, 08:50
Have you tried the Qt tool macdeployqt? It will bundle all necessary libraries and frameworks into your application bundle.

As a matter a fact, I haven't. But, if I understood correctly, this is for deployment purposes.
Do i need to run macdeployqt on every build while developing?
Also, as I read the comments... macdeployqt doesn't include custom libraries, the framework only.

axeljaeger
19th October 2009, 08:53
Ah I see, you already have problems compiling your appilcation. What are the exact error messages you get?

Vnuce
19th October 2009, 09:07
Ah I see, you already have problems compiling your appilcation. What are the exact error messages you get?

Not quite. The projects compile perfectly. First the libraries, then the executables that depend on those libraries (which should mean that the linker finds the libs and links successfully). It's all fine. The app bundles that are created, though, contain only the executables, and nothing more.
When I try to run the application, it crashes saying (libKtX is one of my libraries the executable depends on):

dyld: Library not loaded: libKtX.0.dylib
Reason: image not found

axeljaeger
19th October 2009, 09:08
Add the directories containing the libraries to DYLD_LIBARY_PATH.

Vnuce
19th October 2009, 13:31
Add the directories containing the libraries to DYLD_LIBARY_PATH.

Set DYLD_LIBRARY_PATH as an env var, right? I did... no good :(
Should I restart the machine, or some service in order to take it into account?

Ok.. setting the DYLD_LIBRARY_PATH as an system-wise env var didn't work, but setting it in project's run settings did the trick. Thanks Axel. :)