본문 바로가기

Linux

qtwebkit cross compilation

 

http://webkit.sed.hu/blog/20100427/qtwebkit-cross-compilation-gcc-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

http://trac.webkit.org/wiki/BuildingQtOnLinux

Usually, you can get them from your device which you want to run QtWebKit on.
The following directories are needed:

  • /lib
  • /usr/lib
  • /usr/include

Put them to your SDK directory. (e.g. ~/SDKROOT)

GNU toolchain

For the cross compilation, you can use this GNU toolchain:

http://www.codesourcery.com/downloads/public/gnu_toolchain/arm-none-linu...

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 forqmake.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.
Qmake will be compiled with your g++ for x86 platform when you run ./configure, but qmake will generate make files which will use your ARM toolchain to build Qt libraries.

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.

liubo_from china (not verified) - 05/22/2010 - 04:10

hi,I do the same job recently. Thanks for your help!
As I follow your process,I meet some problems.

First,I want to know the purpose of the dir SDKROOT,and what's the contents in them?

Second,when I did these:
./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
the system had a problems as,
ld:skipping incompatible ~/SDKROOT/usr/lib/libx11.so when searching for -lX11
ld:skipping incompatible ~/SDKROOT/usr/lib/libx11.a when searching for -lX11
cannot find -lX11
And I checked my host machine,Ubuntu9.10,the libX11-dev were the newest.
I don't know why?

Could you tell me your host system's version and your target?
Thanks again!

gabor.rapcsanyi - 05/25/2010 - 09:00

Hi!
The SDKROOT contains the ARM (target) libraries and headers. My host architecture is x86, and the target is ARM.
As I see you try to compile with x86 (host) libs and that cause this linker problem.
I get these ARM libraries from my target machine, but you can cross compile them one by one to your SDKROOT dir if you feel enough power in you :)

liubo_from china (not verified) - 05/26/2010 - 09:33

Thanks,I understand now. I believe that following you tips,I can do the work well by myself.Unfortunately,the time is not allowed.My tutor will check the port(WebKit to ARM) very soon.
So,if it's possible,please send your SDKROOT to me.Thanks a lot!
My email:xb_24@126.com

gabor.rapcsanyi - 05/27/2010 - 11:39

Sorry, but it's too big (~100MB) to send it in e-mail, so try to create an ARM chroot on your host machine and use this chroot libs and headers for the cross compilation.
A good starting point:
https://wiki.ubuntu.com/ARM/BuildEABIChroot

'Linux' 카테고리의 다른 글

possibly undefined macro: AC_PROG_LIBTOOL  (0) 2013.09.26
qtwebkit cross compilation for intel sodaville STB  (0) 2013.09.26
qtwebkit build  (0) 2013.09.26
qt with directFB  (0) 2013.09.26
Udhcpc  (0) 2013.09.26