Overview

GYP tools

GYP tools provide an OS independent way to create a build structure. For example "make files" on Linux. For details see:

http://code.google.com/p/gyp/

Build bot

There is a build bot that constantly builds Chromium for different architectures

http://build.chromium.org/buildbot/waterfall/console

For ARM:

http://build.chromium.org/buildbot/waterfall/builders/Chromium%20Arm

For details see

http://dev.chromium.org/developers/testing/chromium-build-infrastructure

Setup development environment

I used toolchain from http://people.canonical.com/~hrw/ubuntu-maverick-armel-cross-compilers/README

TODO: describe setting chroot on ARM board

Get the source

http://dev.chromium.org/developers/how-tos/get-the-code
http://dev.chromium.org/developers/how-tos/install-gclient

basicaly

$ svn co http://src.chromium.org/svn/trunk/tools/depot_tools
$ export PATH=`pwd`/depot_tools:"$PATH"
# Pick a directory for your build.  We will call this directory $CHROMIUM_ROOT below.
# Check out Chromium:
$ cd $CHROMIUM_ROOT
$ gclient config http://src.chromium.org/svn/trunk/src
$ gclient sync

look at the wiki pages mentioned above if you want to install particular revision

Dependencies

Most likely Ubuntu 10.10 will allow you to have cross packages installed using xdeb, etc In the meen time I installed the necessary packages into ARM board and copied necessary files into rootfs/{lib,usr/lib,usr/include}

rootfs is passed to GYP tools and used in generated Makefiles as a source of includes and libs. It is based on support for -sysroot in GNU cross toolchain.

On the ARM board:

./xbuild-dep.sh
sudo apt-get install symlinks
symlinks -cr /usr/lib

On PC:

(PATH is a path to chroot on the ARM board or empty if everything was done in the nonchroot environment)

rsync -avrl logname@IP:PATH/{usr/include,usr/lib} rootfs/usr/
rsync -avrl logname@IP:PATH/lib rootfs/

if in doubt add -n option to rsync command for a dry run

Run Build

cp xbuild-chromium.sh $CHROMIUM_ROOT/src
cd $CHROMIUM_ROOT/src
./xbuild-chromium.sh

Build Scripts

xbuild-chromium.sh

#!/bin/bash
#set -x
pushd ../../rootfs
ROOTFS=$(pwd)
popd
ARCH=arm
export INCLUDE_DIR=$ROOTFS/usr/include

#Disabled ffmpeg because of yasm problems
#TODO enable them again when finish debugging
export GYP_DEFINES="release_optimize=1 build_ffmpegsumo=0 werror= target_arch=$ARCH sysroot=$ROOTFS disable_nacl=1 linux_use_tcmalloc=0 armv7=1 arm_neon=0 arm_thumb=1 arm_fpu=vfpv3-d16"
#export GYP_DEFINES="werror= target_arch=$ARCH sysroot=$ROOTFS disable_nacl=1 linux_use_tcmalloc=0 armv7=1 arm_neon=0 arm_thumb=1 arm_fpu=vfpv3-d16"
export CROSSTOOL=/usr/bin/arm-linux-gnueabi
export CXX=$CROSSTOOL-g++
#export CXXFLAGS=${CXXFLAGS}" -I$INCLUDE_DIR"
export CXXFLAGS="--sysroot=$ROOTFS -idirafter $INCLUDE_DIR"

#export CFLAGS=${CFLAGS}" -I$INCLUDE_DIR"
#idirafter is used becuse nss.h is taken from /usr/include instead of mozilla/security/nss/lib/nss/nss.h
export CFLAGS=" --sysroot=$ROOTFS -idirafter $INCLUDE_DIR"

export CC=$CROSSTOOL-gcc
export AR=$CROSSTOOL-ar
export AS=$CROSSTOOL-as
export RANLIB=$CROSSTOOL-ranlib
export LINKER_OPTS="--sysroot=$ROOTFS"

./build/gyp_chromium -f make

#TODO: generate options of that config from GYP_DEFINES

pushd third_party/ffmpeg/patched-ffmpeg-mt
./configure --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --enable-shared --disable-static --disable-debug --disable-network --disable-encoders --disable-decoders --disable-hwaccels --disable-muxers --disable-demuxers --disable-parsers --disable-bsfs --disable-protocols --disable-devices --disable-filters --disable-gpl --disable-bzlib --disable-zlib --enable-decoder=theora --enable-decoder=vorbis --enable-demuxer=ogg --enable-pthreads --enable-cross-compile --arch=arm --target-os=linux --enable-armvfp --disable-neon --cross-prefix=${CROSSTOOL}- --extra-cflags='-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3-d16 -mfloat-abi=softfp' --prefix=./chromium-ffmpeg --disable-armv6 --disable-armv6t2  --enable-decoder=vp8 --enable-pic
mv config.h ../config/Chromium/linux/$ARCH
popd

time make -r -j2 BUILDTYPE=Release V=1 chrome 2>&1| tee chromium.log

V=1 cause build to print commands

release_optimize=1 in GYP_DEFINES is a work around. See http://code.google.com/p/chromium/issues/detail?id=38957

xbuild-deps.sh

#!/bin/bash
dev_list="apache2 bison fakeroot flex g++ gperf libapache2-mod-php5
          libasound2-dev libbz2-dev libcairo2-dev libdbus-glib-1-dev
          libgconf2-dev libgl1-mesa-dev libglu1-mesa-dev libglib2.0-dev
          libgnome-keyring-dev libgtk2.0-dev libjpeg62-dev libnspr4-dev
          libnss3-dev libpam0g-dev libsqlite3-dev libxslt1-dev libxss-dev
          lighttpd mesa-common-dev  patch perl php5-cgi pkg-config
          python python-dev rpm subversion ttf-dejavu-core ttf-kochi-gothic
          ttf-kochi-mincho wdiff libcurl4-gnutls-dev"
#msttcorefonts
if egrep -q 'Ubuntu (8\.04|8\.10)' /etc/issue; then
  dev_list="${dev_list} libcupsys2-dev"
else
  dev_list="${dev_list} libcups2-dev"
fi
#sudo apt-get update

# We initially run "apt-get" with the --reinstall option and parse its output.
# This way, we can find all the packages that need to be newly installed
# without accidentally promoting any packages from "auto" to "manual".
# We then re-run "apt-get" with just the list of missing packages.
echo "Finding missing packages..."
packages="${dev_list}"
# Intentially leaving $packages unquoted so it's more readable.
echo "Packages required: " $packages
echo
new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
$(echo $new_list_cmd)

Troubleshooting

For a sanity check you can do a native build and try procedures described below on PC to understand what to expect.

from: http://code.google.com/p/chromium/issues/detail?id=38957#makechanges

Comment 14 by piman@chromium.org, Today (2 hours ago)

Some suggestions, trace the data path:

  • check if test_shell works or not (you can build it with make test_shell). If it doesn't it's likely the bug is in WebKit and/or Skia.

  • If it does, then debug chrome (the renderer process - find the PID from the process manager), check whether the renderer painted correctly. You'll want to check in chrome/renderer/render_widget.cc all the users of PaintRect (mostly DoDeferredUpdate) to see if the contents looks right.

  • If that looked right, then debug the browser process, check in chrome/browser/renderer_host/backing_store_x.cc if PaintToBackingStore gets the right data and if it paints the backing store correctly.

  • If that was right too, then debug the XShowRect/CairoShowRect/PaintToRect functions in the same file, that copies from the backing store to the window.

Some details how to do it:

test_shell

http://www.chromium.org/developers/testing/webkit-layout-tests

  • building test_shell
  • running tests

Debugging Chromium

http://code.google.com/p/chromium/wiki/LinuxDebugging#GDB


CategoryCrossCompile

Resources/HowTo/CrossBuildingChromiumBrowser (last modified 2011-04-12 21:29:51)