The goal – to create a cross platform application infrastructure for Linux, Windows and Mac that will serve as the basis for future cross platform application.
I first thought of using wxwidgets but noticed that there were problems getting it to compile on Mountain Lion OS/X. In addition, Qt seemed more equipped to handle to sort of functionality and support I require in the projects that will be developed. Although Nokia recently sold Qt to Digia, my assumption is that it will continue to be developed and supported by a wide community of developers.
In addition, a secondary goal is to evaluate Necessitas, the Qt port for the Android platform and check work in process for iOS and Windows Phone.
I’ll first focus on the process for Linux (tested on Ubuntu 12.04) and OS/X (tested on Mountain Lion).
First thing’s first – download the Qt libraries for Linux/X11, extract, cd to the folder and
./configure. You will be asked if you want to use the open source or commercial license version (since the open source license is LGPL, I assume choosing this option creates a shared library). after some additional questions, the configure process will begin to create the make file (its a big project so give it time). Finally, if all goes well you should see:
Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/Trolltech/Qt-4.8.3 To reconfigure, run 'make confclean' and 'configure'.
make to take a very long while (as in take a long lunch break). This is a huge project.
From the location specified above, you can either download the two dmg files (library and debug) or download the same file as for Linux if you wish to go through the compilation process. In the latter case, there are some changes in the compilation method that are specified here. I opted for the easier method of simply downloading and installing the dmg files.
Another (and perhaps better) option on OS/X is to install homebrew and simply issue an
brew install qt
Compiling and running an example ∞
On Linux the tutorial sample is located at
qt-everywhere-opensource-src-4.8.3/examples/tutorials/gettingStarted/gsQt/part1 (under the directory you extracted it to).
To make the sample, issue:
qmake -project qmake make
On OS/X the tutorial sample is located at
To make the sample, issue:
qmake -spec macx-g++ qmake make
On my Mac, the
make resulted in the following error:
g++: error: x86_64: No such file or directory g++: error: unrecognized option '-arch' g++: error: unrecognized option '-Xarch_x86_64' make: *** [main.o] Error 1
if you get compilation errors during make, your compilers could be different from the standard versions for your Xcode. If you have Xcode 4.3 or newer, you should install the Command Line Tools for Xcode from within Xcode’s Download preferences (via menu: Xcode->Preferences…).
I learned the above from homebrew (which by the way is a great package manager for OS/X – bye bye fink and macports) after installing it and running
homebrew doctor. Once I installed the command line tools for Xcode the make completed smoothly.