Qmake on PowerPC

I’ve recently started learning Qt on mac and I’ve ran into a number of problems. One of the problems was caused by qmake creating a Makefile or Xcode project that specified / limited the target arch to i386. The first problem is that qmake creates a Xcode project on Mac by default, I’ve not used Xcode in quiet some time and was confused as to why “ppc” was not an option.

Missing PowerPC option in Xcode

Right click on your Xcode project file and select “Show Package Contents”, then open “project.pbxproj” with your faviourt text editor. Replace “i386” (without the quotes) with "$(ARCHS_STANDARD_32_BIT)" (including the quotes). Now when you open your Qt Xcode project file you should have both ppc and i386 available in the drop down menu.

Makefile

I personally prefer to code in my own text editor and compile the code in the terminal. To do this I need a Makefile, luckly these can also be generated by qmake by using one of the built in specs. Just type “qmake -spec macx-g++ ” and it will generate a i386 Makefile for you.

You have a choice to either compile for a single architecture, PowerPC, or to create a universal binary. To do the first simply replace “i386” with “ppc”. To do the latter add “-arch ppc” after “-arch i386“. These occur multiple times in the Makefile so it’s best to use find and replace for this.

Why use qmake?

When my Qt code / appilcation was only in a single file I would compile it by using:
[source] g++ -framework QtGui -framework QtCore -o test [/source]
This worked fine until I started using the Q_Object macro then I started getting “undefined symbol” errors. The solution to these errors was to seperate the definition, implication and main function into seperate files; in my case window.h, window.cpp and main.cpp. This was when I started using qmake instead of writing my own Makefile.

This was a problem I faced and had a hard time finish solutions to online. I hope what I’ve written has helped you compile Qt code on your PowerPC mac. You could probably write a sed command to make the needed changes but I’m no good at that. Thanks for reading and happy coding 🙂