Zaurus ARM Cross Compiler on OS X (Intel)

Andreas Junghans has an excellent tutorial on how to set up a Zaurus ARM cross compiler on OS X. However, there is one problem: It will only compile on PowerPC.
So, here is my patchset for compiling on Intel:

gcc-patches.tgz

Use this file instead of the one offered on his page and just follow his instructions.
The fix is really simple in nature: I’ve just added one file, namely xm-openstep.h in gcc/config/i386. This does the trick.

12 thoughts on “Zaurus ARM Cross Compiler on OS X (Intel)

  1. Thank you very much for this. I was able to compile the toolchain without problems.
    Were you able to get the qtopia part working too? I tried to follow the tutorial for that part too, but it fails while tried to build the “native Qt/Embedded …”

    Please let me know if you have any ideas/patches for this one too!

    Best regards,

    echo ‘#include “kernel/qt.h”‘ >allmoc.cpp
    g -E -DQT_MOC_CPP -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include -I/usr/X11R6/include -pipe -fno-exceptions -DQWS -fno-rtti -fno-exceptions -DQT_NO_QWS_LINUXFB -DQT_NO_QWS_TRANSFORMED -O0 -Wall -W -DNO_DEBUG -fPIC -DQT_NO_IMAGEIO_MNG -DQT_NO_QWS_VOODOO3 -DQT_NO_QWS_MACH64 -DQT_NO_QWS_MATROX -DQT_NO_QWS_VNC -DQT_NO_QWS_VGA_16 -DQT_NO_QWS_DEPTH_24 -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/src/3rdparty/zlib -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/src/3rdparty/libpng -I/usr/X11R6/include -I3rdparty/freetype/src -I3rdparty/freetype/include -I3rdparty/freetype/builds/unix -I3rdparty/kernel -I3rdparty/tools >allmoc.h allmoc.cpp
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/bin/moc -o allmoc.cpp allmoc.h
    perl -pi -e ‘s{“allmoc.h”}{“kernel/qt.h”}’ allmoc.cpp
    rm allmoc.h
    g -c -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include -I/usr/X11R6/include -pipe -fno-exceptions -DQWS -fno-rtti -fno-exceptions -DQT_NO_QWS_LINUXFB -DQT_NO_QWS_TRANSFORMED -O0 -Wall -W -DNO_DEBUG -fPIC -DQT_NO_IMAGEIO_MNG -DQT_NO_QWS_VOODOO3 -DQT_NO_QWS_MACH64 -DQT_NO_QWS_MATROX -DQT_NO_QWS_VNC -DQT_NO_QWS_VGA_16 -DQT_NO_QWS_DEPTH_24 -DQT_BUILTIN_GIF_READER=0 -DQT_NO_IMAGEIO_JPEG -DQT_NO_IMAGEIO_MNG -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/src/3rdparty/zlib -I/Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/src/3rdparty/libpng -I/usr/X11R6/include -I3rdparty/freetype/src -I3rdparty/freetype/include -I3rdparty/freetype/builds/unix -I3rdparty/kernel -I3rdparty/tools -o allmoc.o allmoc.cpp
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qdatetime.h:51: warning: ‘class QDate’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qsortedlist.h: In destructor ‘QSortedList::~QSortedList()’:
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qsortedlist.h:51: error: there are no arguments to ‘clear’ that depend on a template parameter, so a declaration of ‘clear’ must be available
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qsortedlist.h:51: error: (if you use ‘-fpermissive’, G will accept your code, but allowing the use of an undeclared name is deprecated)
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qasyncimageio.h: At global scope:
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qasyncimageio.h:48: warning: ‘class QImageConsumer’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qpolygonscanner.h:48: warning: ‘class QPolygonScanner’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qrangecontrol.h:52: warning: ‘class QRangeControl’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qtooltip.h:87: warning: ‘class QToolTip’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:214: warning: ‘class QXmlReader’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:402: warning: ‘class QXmlContentHandler’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:419: warning: ‘class QXmlErrorHandler’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:428: warning: ‘class QXmlDTDHandler’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:436: warning: ‘class QXmlEntityResolver’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:443: warning: ‘class QXmlLexicalHandler’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qxml.h:456: warning: ‘class QXmlDeclHandler’ has virtual functions but non-virtual destructor
    /Users/mat/Desktop/cross-compile-for-zaurus/src-dir/qtopia.mac/qt-embedded/include/qwindowsystem_qws.h:220: warning: ‘class QWSServer::KeyboardFilter’ has virtual functions but non-virtual destructor
    make[1]: *** [allmoc.o] Error 1
    make: *** [sub-src] Error 2

  2. I haven’t been able to compile QTE/Qtopia on OS X Intel. It’s pretty tough to build the native part because OS X Intel only includes GCC 4.x which is exceptionally picky about C templates and the like. The GCC 3.x included is only able to produce PowerPC code. Changing the QTE code to cope with the GCC 4.x complaints may be possible, but to be honest, I see no time and reason to do so.
    For now, I’ve bought Parallels Desktop and am happily running Debian in a VM. You can use the Apple X11 server to display the Qtopia Virtual Frame buffer client running in Debian (or whatever Linux you choose) on your Mac desktop. Just
    xauth YourDebiansIP
    in xterm on your Mac and then on Debian do
    export DISPLAY=”YourMacsIP:0.0″.
    If you’re adventurous, you can try the following: Install distccd on your Mac, configure it so that it uses the cross-compiler GCC and then tell your Debian to use distcc for compiling. That way you can take advantage of multiple cores in your system for speed.
    That’s what I’m using right now. Can’t promise, but perhaps I may post some instructions over the holidays, if I find a few minutes free time… ;)

  3. Thank you very much for your reply! I’m not that profficient in these kind of things, so I guess I try to build qtopia for the zaurus, and go with debian for testing. Maybe with qemu.
    Regards,

  4. I was wondering if you had been able to build the cross-compile part of qte/qtopia with the script. The base script has a “skipnative” variable, which will go to the cross-compile directly if set to something else than 0. I set that, but still got an error when trying to build the zaurus part. (It says unable to execute the file “moc”, which is no surprise as the file is an ARM binary….)

  5. No, sorry. No progress there. I tried the skipnative variable too, but to no avail. Same problem with moc. It might be possible to compile the meta object compiler directly with GCC 4.x, but I haven’t tried it yet.

  6. To build qtopia apps for zaurus on the mac:

    1. Set up the ARM cross compiler as above.
    2. Get the nice new zgcc2 setup, we are concerned primarily with the “include” pack.
    3. Get qtopia/zaurus related header files from this pack, put them on mac.
    4. Copy all of the libraries from your zaurus onto the mac.
    5. Set up proper environment variables to point to locations of all the files you just ripped.

    To sanify your build environment, you can look at the scripts provided by zgcc2 for a starting point to see what is required.

    Now you should be able to compile zaurus-qtopia code on your mac (but not run it there of course)

    In summary, you are using your mac ARM toolchain to build directly against the libaries on your zaurus.

    In the end it may be easier/faster to just use zgcc2,ssh,sshfs/nfs/samba if your compile times are short anyway.

  7. Sorry, I should have said: To build qtopia apps for zaurus on the INTEL mac while avoiding gcc4.

  8. Thanks for the hints, Taylor. Any idea where I can get Intel binaries of the moc and uic tools? Those are missing here. AFAIK the Qt3 tools won’t work with Qt2…

  9. I wasn’t making a QT gui for this setup, I was actually using SDL. The only reason QT got involved is that I needed to -lqte for zaurus qtopia SDL programs to build! I know it’s possible to make qt apps w/o moc, but that’s no fun…

    Come to think of it, we’d need tmake too, right? Geez, getting a fully functional dev setup on intel seems impossible.

    Has anyone built gcc3.x for intel mac, and then tried to build qtopia? I got gcc3.x built (after 2-3 potentially detrimental hacks). Qtopia still wouldnt go though. After a few hacks in the qtopia code I got it to build most of the way, but gave up cuz I think the gcc3 modifications were a bad idea.

  10. Yes, Nikolaus, great to see the Intel version is online! Last time I checked only the PowerPC binary was available. That was also the reason I looked into compiling for Intel…

  11. Well, indeed the old PowerPC binary was working well enough on an Intel Mac in emulation mode (Rosetta!) so that I didn’t have the need to rebuild the compiler last year. So I did it I think back in March 07 (without knowing this page and thread).

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.