Building Qt 4.6 for Maemo 5 apps on Mac OS X
Recently, the Maemo team released the preview of their new tool chain named MADDE. It allows building Maemo 5 applications also on Mac and Windows. Unfortunately, it currently only supports Qt 4.5.x, not the shiny new (and unstable) Qt 4.6 for Maemo 5. After a bit of fiddling I managed to to create a patch that allows building Qt 4.6 apps for Maemo 5 on Mac OS X.
Read on if you're into adventures, otherwise please stop reading here and wait for the official Qt 4.6 MADDE support packages :)
After downloading and installing MADDE, we first need to install the Qt 4.6 for Maemo 5 libraries. For that, we take the qt4-maemo5 Debian packages from repository.maemo.org. First, we need libqt4-maemo5-dev_4.6.0~git20091218-0maemo1_armel.deb. The Debian package can be decompressed with the ar x command. This extracts three files, but we only need data.tar.gz, which must be extracted in $HOME/.madde/0.5/sysroots/fremantle-qt-arm-sysroot-0942. To verify that everything went well, check the contents of $HOME/.madde/0.5/sysroots/fremantle-qt-arm-sysroot-0942/opt/qt4-maemo5/include, this directory should now contain all Qt header files. Repeat the unpacking for every Qt library that your project needs, starting with libqt4-maemo5-core_4.6.0~git20091218-0maemo1_armel.deb.
Almost there :) The host tools (qmake, moc, rcc, uic) in MADDE are from Qt 4.5.x, so we can't use them for Qt 4.6 development. Copying them from a Qt for Mac OS X installation is sub-optimal, since qmake is assuming that we're building Mac OS X applications. So, we also need the Qt sources that match the Debian packages. You can also grab them from repository.maemo.org (make sure the version+date of the source package matches the version+date of the binary packages you installed above). After uncompressing, apply this really ugly patch (*) and run the following commands:
# first, we need to configure Qt for Maemo 5, telling qmake to use the "madde" mkspec
./configure -maemo5 -xplatform linux-g++-madde -x11 --force-pkg-config -no-opengl --prefix=/opt/qt4-maemo5
# install qmake and the mkspecs
sudo make install_mkspecs install_qmake
# build the other tools (moc, rcc, uic)
../../bin/qmake -spec ../../mkspecs/macx-g++ -r -macx -o Makefile tools.pro
sudo make install
Now, we should have qmake, moc, rcc and uic in /opt/qt4-maemo5/bin on our Mac OS X host.
Make sure that the mad command is in your PATH, then go to your project and run /opt/qt4-maemo5/bin/qmake. Do not run mad qmake, since that'll invoke the Qt 4.5.x qmake. Now, we can just type make to build the project. Note that instead of running g++, we'll invoke mad g++ to create an ARM binary. After compilation, you can check your binary with the file command. The output should look something like that:
ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8
If you've got this far, congratulations, you've built a Qt 4.6 for Maemo 5 application on Mac OS X :)
Complex? Yes, it is :) But no worries, we plan full support for MADDE without having to mess around with patching and manually uncompressing things. I even heard rumors that a Qt Creator + MADDE blog will surface soon :)
(*) Disclaimer: The patch was done after a lot of Christmas festivities including lots of food. Given the amount of things I ate, I estimate that 90% of the work was influenced by my stomach, with my brain being only partially involved
Subscribe to our newsletter
Try Qt 5.15 LTS Now!
Download the latest release here: www.qt.io/download.
Qt 5.15 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu