Building Qt-4.8.6 x64 on OS X 10.10 with Xcode 6.x so that it works on OS X 10.6+

Mostly for my own benefit, but might be useful to others.

First, you will need the latest Xcode and the latest Qt 4 release source code from http://www.qt.io, at the time I wrote this, it’s Xcode 6.1.1 and Qt 4.8.6. You will also need my patch to Qt (qt-4.8.6-mac.patch, can be found here https://github.com/sandym/qt-patches).

We will do a shadow build, that is we build out of the Qt source tree.  For this, I decompress Qt in a folder named qt-4.8.6 and I create a folder named qt-4.8.6-build next to it. So I have 2 folders, qt-4.8.6 (the sources) and qt-4.8.6-build (empty, where we will build) and a file (qt-4.8.6-mac.patch). Let’s start.

From the Terminal, first apply the patch to the source tree:
> cd qt-4.8.6
> patch -p1 < ../qt-4.8.6-mac.patch

You should make sure to remove all non-Apple tools you might have installed (like Macports in my case):
> export PATH=/usr/bin:/bin:/usr/sbin:/sbin

Configure, note that this is the configuration I use and know to work, you might have some luck with something different, but some do fail. You’re on your own if you do it differently.
> cd ../qt-4.8.6-build
> ../qt-4.8.6/configure -debug-and-release -no-qt3support -prefix /usr/local/Qt-4.8.6 -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-libtiff -no-libmng -no-dbus -no-nis -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -arch x86_64

Build and install:
> make -j3
> sudo make install

Done!

2 thoughts on “Building Qt-4.8.6 x64 on OS X 10.10 with Xcode 6.x so that it works on OS X 10.6+

Leave a comment