PDA

View Full Version : Qt 4.6.1 from Windows/Linux to Mac OS X - .dylib vs .so?



wizard_oz
15th February 2010, 18:56
Hello,

I have been battling with compiling a test C++ application on OS X, v10.6 "Snow Leopard". We're mostly Windows developers, though we have experience with Linux as well, and have compiled a few internal software projects on Linux as well as Free/OpenBSD.

In my projects, I currently only use Qt functionality that is present in the QtCore module, as such, I need to link against libQtCore.4.so on Linux and QtCore4.dll on Windows. This works fine on Windows/Linux, no problems.

I have since moved on to OSX, and I'm having a hard time, mostly because I'm confused about the .dylib libraries that Qt produces there. Or, better, I'm confused about the .dylib concept in general.

I compiled Qt from source, with the "-no-framework" option, as I was hoping that this would yield a libQtCore.4.so file. No such luck however, as it only generates a libQtCore.4.dylib file.

Consequently, the linker complains:

ld: library not found for -lQtCore

At this point I am unsure as to whether Qt supplies .so files at all? So I suppose my questions would be:

* Can I compile Qt on OS X so that it generates .so files?
* If so, can I still create a GUI-based app just linking against those .so files?

* If I can't, then how do I link against those .dylib files with g++ / ld?

* Can I link against .so and .dylib files at the same time?

I've been unsuccessful with this for several hours now, and any help and pointers to the right direction would be appreciated.


/IJFK.

wizard_oz
16th February 2010, 00:12
As it turns out, the reason why the linker couldn't find libQtCore.4.dylib is because I had passed the library search directory with a space. Instead of supplying

g++ -o myapp -L/path/to/qt/lib

I had specified

g++ -o myapp -L /path/to/qt/lib

which worked on Linux/BSD, but apparently not on OS X. Seems to be working now. Apparently the linker will automatically link against a .dylib file and there is nothing special that needs to be done.