Cross-compiling QT

From Nuclear Physics Group Documentation Pages
Revision as of 10:21, 28 August 2009 by Maurik (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Cross Compiling QT for ARM from Linux

As much as I would have liked, this is impossible (or nearly so, I couldn't make it work) from the Mac. The reason seems to be that the configure scripts for QT are quite insistent on building some Mac stuff (as they should), but the relevant distribution for Mac does not have the correct codes for cross compiling and the distribution for cross compiling does not have the relevant Mac stuff. Let me know if you figure this one out.

You can use these instructions to build the

Needed tools

Before you start you need to setup your cross compile environment. Follow: ARM Cross Compiler and don't forget to put in the libs and includes.

Setting up

I grabbed qt-embedded-linux-opensource-src-4.5.2.tgz from the Troll Tech website and untarred it. Next cd into the qt-embedded-linux-opensource-src-4.5.2 directory.

You need to fixup the mkspecs/qws/linux-arm-g++/qmake.conf file to read:

# 
# qmake configuration for building with arm-linux-gnu-g++
#

include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnu-gcc
QMAKE_CXX               = arm-linux-gnu-g++
QMAKE_LINK              = arm-linux-gnu-g++
QMAKE_LINK_SHLIB        = arm-linux-gnu-g++

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnu-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnu-objcopy
QMAKE_STRIP             = arm-linux-gnu-strip

load(qt_config)

Next, since we are building in a build directory, you will need to make a fix. It is a bit odd, but easier than fixing the configure script. From the qt-embedded-linux-opensource-src-4.5.2 dir, make a link of the src as follows:

ln -s src ../src

Run Configure

First, make sure the /usr/local/arm-linux/gnu/bin is in your PATH.

Make a build directory and run configure there:

 mkdir build-arm-linux-gnu
 cd build-arm-linux-gnu
 ../configure -embedded arm -arch arm -xplatform qws/linux-arm-g++ -platform linux-g++ -opensource -confirm-license -no-armfpa -little-endian -nomake demos -nomake examples -no-svg -no-phonon -no-qt3support -host-little-endian -prefix /usr/local/arm-linux-gnu/usr/local/Qt4.5 -L /usr/local/arm-linux-gnu/usr/lib -I /usr/local/arm-linux-gnu/usr/include -lX11 | tee Configure.log

The configure takes a long time, and will build a local "qmake" for you.