WebKitGtk+ cross compilation for ARM

WebKitGtk+ cross compilation consists of two parts. First, you need a cross compiler and the library dependencies of WebKitGtk+. Next, you have to setup the build system properly. You can reach this with some wrapper scripts.

Toolchain

For the cross compilation you need a toolchain. In this post I use this GNU toolchain:

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

Unpack this to your toolchain directory. (e.g. ~/TOOLCHAIN)

Library dependencies

In my previous post, I've shown which libraries needed for WebKitGtk+ and how you can compile them. If you follow the steps given there, you can find the ARM target root dir at

~/scratchbox/users/arm-user/targets/DIABLO_ARMEL

There, you'll need these directories:

  • lib
  • usr/lib
  • usr/include

Copy these directories to your sdk root. (e.g. ~/ARM-SDK)

If you want to compile these dependecies by hand, you can find the dependency list at http://trac.webkit.org/wiki/BuildingGtk.

In the ~/ARM-SDK/usr/lib directory, there are some *.la files. These files contain the library paths with a wrong prefix. You can fix them with the following script:

set_la_prefix.sh:

#!/bin/bash

#This script sets the prefixes in the .la files to SDKROOT
export SDKROOT="~/ARM-SDK"

prefixed_la="prefixed_la"

cd $SDKROOT/usr/lib
mkdir $prefixed_la

for filename in `ls -l | grep ^- | awk '{print $8}'`
do 
  cat $filename | \
  sed "s/'\/usr/'$(echo $SDKROOT | sed 's/\//\\\//g')\/usr/g" | \
  sed "s/ \/usr/ $(echo $SDKROOT | sed 's/\//\\\//g')\/usr/g" > $prefixed_la/$filename
done

mv $prefixed_la/* . 
rm -rf $prefixed_la



(In ~/ARM-SDK/usr/include there are some system headers, which may cause some compilation errors since the toolchain contains these headers too, but if you delete these from your sdk, the errors will be gone.)

Wrapper scripts

For the WebKitGtk+ cross compilation, you need some wrapper scripts:

pkg-config:

#!/bin/bash

export PKG_CONFIG_LIBDIR="$SDKROOT/usr/lib/pkgconfig"
/usr/bin/pkg-config --define-variable=prefix=$SDKROOT/usr $@



icu-config:

#!/bin/bash

/usr/bin/icu-config --prefix=$SDKROOT/usr $@



Put these scripts to a cross binary directory e.g. ~/CROSS_BIN, (And don't forget to give them executing permission.)

Cross compilation script

Now, you just need a build script that integrates these.

build-webkit.sh:

#!/bin/bash

export SDKROOT="~/ARM-SDK"
export TOOLCHAIN="~/TOOLCHAIN/arm-2008q3"
export PATH="~/CROSS_BIN:$PATH"

export CPPFLAGS="-I$SDKROOT/usr/include"
export LIBS="$LIBS -L$SDKROOT/lib -L$SDKROOT/usr/lib"

export CC="$TOOLCHAIN/bin/arm-none-linux-gnueabi-gcc"
export CXX="$TOOLCHAIN/bin/arm-none-linux-gnueabi-g++"
export LINK="$TOOLCHAIN/bin/arm-none-linux-gnueabi-g++"
export LINK_SHLIB="$TOOLCHAIN/bin/arm-none-linux-gnueabi-g++"
export AR="$TOOLCHAIN/bin/arm-none-linux-gnueabi-ar"
export OBJCOPY="$TOOLCHAIN/bin/arm-none-linux-gnueabi-objcopy"
export STRIP="$TOOLCHAIN/bin/arm-none-linux-gnueabi-strip"

export BUILD_WEBKIT_ARGS="--host=arm-none-linux-gnueabi --build=i686-pc-linux-gnu --target=arm"

cd ~/WebKit

WebKitTools/Scripts/build-webkit --gtk --release



If you've set up everything properly, you can cross compile the WebKitGtk+ without any emulators.

Anonymous (not verified) - 04/23/2010 - 12:41

Hi,
I am trying to compile the webkit-1.2.o previously i was using webkit-1.1.14. But while compiling the webkit-1.2.0 I am getting error as below.

In file included from ./WebCore/config.h:26,
from WebCore/accessibility/AXObjectCache.cpp:29:
./JavaScriptCore/wtf/Platform.h:291:6: #error "Not supported ARM architecture"
In file included from ./WebCore/platform/text/AtomicString.h:24,
from ./WebCore/platform/text/AtomicStringHash.h:32,
from ./WebCore/dom/EventTarget.h:35,
from ./WebCore/dom/Node.h:28,
from ./WebCore/dom/RangeBoundaryPoint.h:29,
from ./WebCore/dom/Range.h:29,
from WebCore/accessibility/AccessibilityObject.h:34,
from WebCore/accessibility/AXObjectCache.h:29,
from WebCore/accessibility/AXObjectCache.cpp:30:
./WebCore/platform/text/AtomicStringImpl.h:29: error: base `WebCore::StringImpl' with only non-default constructor in class without a constructor
make[2]: *** [WebCore/accessibility/libwebkit_1_0_la-AXObjectCache.lo] Error 1

Can you please help me on this ?

Thanks,
Venu.

gabor.rapcsanyi - 04/27/2010 - 10:42

Hi,
I experienced the same problem when I try to compile WebKitGtk+ with 3.4.4 GCC. Try to use a newer one. It works for me with 4.3.2 GCC version.

Gabor

Anonymous (not verified) - 04/27/2010 - 19:59

Thanks for your reply. From where I can download the latest arm-linux-gcc. currently i am using 3.4.4 arm-linux-gcc.

Venu

gabor.rapcsanyi - 04/28/2010 - 12:13

I don't know where you can find that. I get my toolchain from here:

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

caraprince (not verified) - 10/27/2010 - 02:32

hi,
i'm building gtk-webkit-1.2.3 for arm, and my toolchain is gnu 4.2.2 gnueabi. i sufferred a problem that the GtkLauncher crashed on gtk+webkit+xorg. a segmentation fault occurs when doing StringHash functions. do you have any comments for this?

thanks

Kevin

Anonymous (not verified) - 09/13/2013 - 11:29

I want to crosss compile currently latest webkitgtk2.0.4 with opengl es, but I find that I don't know how to configurate the build option for webkitgtk+,gtk+, cairo, pango. can you help to provide some clues, thanks

gabor.rapcsanyi - 09/19/2013 - 08:56

I'm not very familiar with the current state of WebKitGtk+ build system but as far as I know it is using jhbuild to compile the latest libs what it requires. You can find and modify the modules config here: WebKit/Tools/gtk/jhbuild.modules

arvind (not verified) - 10/17/2013 - 10:46

Hi when im compiling webkit-1.5.1 i got some errors while doing make.
error log:
GEN stamp-webkitmarshal.cpp
/bin/bash: line 1: /usr/bin/glib-genmarshal: cannot execute binary file
make: *** [stamp-webkitmarshal.cpp] Error 126

if any one knows about this error please give me solution to getout of this error.

Thanks & Regards:
Raybiztech

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank