QtWebKit cross compilation with GCC for ARM-Linux
When I tried to cross compile QtWebKit for ARM-Linux, I didn't find any clear description, so I have decided to write a blogpost about it. It's not too hard, but if you have never done something like this, it can be a little bit confusing. In this post, I will describe this method in some simple steps.
Dependent libs and headers
The dependent libs can be found at
Usually, you can get them from your device which you want to run QtWebKit on.
Put them to your SDK directory. (e.g. ~/SDKROOT)
For the cross compilation, you can use this GNU toolchain:
Unpack this to your toolchain directory. (e.g. ~/TOOLCHAIN)
Qt cross compilation
First download Qt-4.6.0 and unpack it.
wget ftp://ftp.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz tar -xf qt-everywhere-opensource-src-4.6.0.tar.gz
In your qt-everywhere-opensource-src-4.6.0/ directory, there are a lot of make specifications in mkspecs dir. You have to change the qws/linux-arm-g++ one. In this directory , look for qmake.conf and modify it as follows:
QMAKE_CC = arm-none-linux-gnueabi-gcc QMAKE_CXX = arm-none-linux-gnueabi-g++ QMAKE_LINK = arm-none-linux-gnueabi-g++ QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ # modifications to linux.conf QMAKE_AR = arm-none-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy QMAKE_STRIP = arm-none-linux-gnueabi-strip
Now, our Qt is ready for the compilation.
export PATH=~/TOOLCHAIN/arm-2008q3/bin:$PATH cd qt-everywhere-opensource-src-4.6.0 ./configure -arch arm -xplatform qws/linux-arm-g++ -release -openssl \ -I~/SDKROOT/usr/include -L~/SDKROOT/usr/lib -L~/SDKROOT/lib \ -lX11 -lxcb -lXau -lXdmcp -lXext \ --prefix=/usr/local/Trolltech/Qt-4.6.0-arm-cross make && make install
Now, you have a brand new cross compiled Qt.
QtWebKit cross compilation
QtWebKit cross compilation is very simple now. You just have to set up some environment variables, and then you are ready for the compilation with the build-webkit script.
QTDIR="/usr/local/Trolltech/Qt-4.6.0-arm-cross" export PATH=$QTDIR/bin:$PATH export PATH=~/TOOLCHAIN/arm-2008q3/bin:$PATH export BUILD_WEBKIT_ARGS="QMAKESPEC=qws/linux-arm-g++ DEFINES=QT_NO_UITOOLS LIBS+=-lm \ LIBS*=-lsqlite3 LIBS*=-lexpat LIBS*=-lfreetype LIBS*=-lz LIBS*=-lXrender \ QMAKE_CXXFLAGS+=-I~/SDKROOT/usr/include LIBS*=-L~/SDKROOT/usr/lib LIBS*=-L~/SDKROOT/lib" cd WebKit WebKitTools/Scripts/build-webkit --qt --release
Now, your QtWebKit is ready for running on your ARM device.