Compiling Chromium Browser for PI (Done)

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Compiling Chromium Browser for PI (Done)

Postby moonman » Fri May 31, 2013 8:02 am

Package now is in the official repository:
$this->bbcode_second_pass_code('', 'pacman -Sy chromium')
______________________________________________________________________________________________
Grab the package here: $this->bbcode_second_pass_code('', 'pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/RaspberryPI/chromium/chromium-27.0.1453.93-3-armv6h.pkg.tar.xz')
______________________________________________________________________________________________
I'm trying to compile chromium browser for the pi. I'll document things as I go here for future reference.

PKGBUILD (some sha256sums are wrong):
$this->bbcode_second_pass_code('', '# $Id: PKGBUILD 160354 2012-06-01 12:58:14Z dreisner $
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Pierre Schmitz <pierre@archlinux.de>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

# Building for x86_64 requires lib32-glibc & lib32-zlib from [multilib]. These
# libraries are linked from the NaCl toolchain, and are only needed during
# build time.

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - removed NaCl, not for ARM
# - adjusted gyp flags for v7h

buildarch=4
highmem=1

pkgname=chromium
pkgver=27.0.1453.93
pkgrel=3
pkgdesc="The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser"
arch=('armv6h')
url="http://www.chromium.org/"
license=('BSD')
depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'bzip2' 'libevent' 'libxss'
'libgcrypt' 'ttf-font' 'udev' 'dbus' 'flac' 'opus' 'libwebp'
'speech-dispatcher' 'pciutils' 'libpulse' 'desktop-file-utils'
'hicolor-icon-theme')
makedepends=('python2' 'perl' 'gperf' 'yasm' 'mesa' 'libgnome-keyring'
'elfutils' 'subversion')
optdepends=('kdebase-kdialog: needed for file dialogs in KDE')
# Needed for the NaCl toolchain
[[ $CARCH == x86_64 ]] && makedepends+=('lib32-zlib')
provides=('chromium-browser')
conflicts=('chromium-browser')
backup=('etc/chromium/default')
install=chromium.install
source=(http://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz
chromium.desktop
chromium.default
chromium.sh
chromium-pnacl-r0.patch
chromium-27.0.1453.93-allow-sample-rate-pass-through-on-linux.patch
chromium-27.0.1453.93-fix-crash-when-quickly-dragging-a-new-tab.patch
chromium-26.0.1410.43-speechd-0.8.patch
die-sysroot-die.patch)
sha256sums=('7af8f70745992afdee0196039b5beab1b86b6de7fa70ca4f4a04dc335f034b3f'
'09bfac44104f4ccda4c228053f689c947b3e97da9a4ab6fa34ce061ee83d0322'
'478340d5760a9bd6c549e19b1b5d1c5b4933ebf5f8cfb2b3e2d70d07443fe232'
'4999fded897af692f4974f0a3e3bbb215193519918a1fa9b31ed51e74a2dccb9'
'9875ffcc0e9ae9420876ac66b130b1b017d445a031d43cbe0119793e1fb3781c'
'23b04468881642ffdc8457016c8f91df395dfccb4af2ad6b758168180ae070f3'
'c57d760589af1566469fbba0d85624b53eb07a3077485599f599a226dbd4d2a8'
'd530f52cb485ff8da035b38ffebe171309a1d8e515040f5e6398ecb286336797'
'66705264d9e679a58ed522b4475a06c8a5a4fe52a709c537b1a7d5aa43fb6c84')

prepare() {
cd "$srcdir/$pkgname-$pkgver"

# Remove ARM sysroot garbage
patch -Np1 -i "$srcdir/die-sysroot-die.patch"

# Fix build without pnacl (patch from Gentoo)
patch -Np0 -i "$srcdir/chromium-pnacl-r0.patch"

# Allow sample rate pass through on Linux
# https://code.google.com/p/chromium/issues/detail?id=229918
patch -Np1 -i "$srcdir/chromium-27.0.1453.93-allow-sample-rate-pass-through-on-linux.patch"

# Fix crash when quickly dragging a new tab
# https://code.google.com/p/chromium/issues/detail?id=228918
patch -Np1 -i "$srcdir/chromium-27.0.1453.93-fix-crash-when-quickly-dragging-a-new-tab.patch"

# Fix header location for speech-dispatcher 0.8 (patch from PLD Linux)
patch -Np2 -i "$srcdir/chromium-26.0.1410.43-speechd-0.8.patch"

msg2 "Use Python 2"
find . -type f -exec sed -i -r \
-e 's|/usr/bin/python$|&2|g' \
-e 's|(/usr/bin/python2)\.4$|\1|g' \
{} +
# There are still a lot of relative calls which need a workaround
mkdir "$srcdir/python2-path"
ln -s /usr/bin/python2 "$srcdir/python2-path/python"
}

build() {
cd "$srcdir/$pkgname-$pkgver"

export PATH="$srcdir/python2-path:$PATH"

# CFLAGS are passed through release_extra_cflags below
export -n CFLAGS CXXFLAGS

# Silence "locally defined but not used" warnings in Chromium and WebKit
CFLAGS+=' -Wno-unused-local-typedefs'

build/gyp_chromium --depth=. \
-Dwerror= \
-Dlinux_link_gsettings=1 \
-Dlinux_link_libpci=1 \
-Dlinux_link_libspeechd=1 \
-Dlinux_link_pulseaudio=1 \
-Dlinux_sandbox_path=/usr/lib/chromium/chromium-sandbox \
-Dlinux_strip_binary=1 \
-Dlinux_use_gold_binary=0 \
-Dlinux_use_gold_flags=0 \
-Drelease_extra_cflags="$CFLAGS -DUSE_EABI_HARDFLOAT" \
-Dffmpeg_branding=Chrome \
-Dproprietary_codecs=1 \
-Duse_system_bzip2=1 \
-Duse_system_flac=1 \
-Duse_system_ffmpeg=1 \
-Duse_system_libevent=1 \
-Duse_system_libjpeg=1 \
-Duse_system_libpng=1 \
-Duse_system_libwebp=1 \
-Duse_system_libxml=0 \
-Duse_system_opus=1 \
-Duse_system_ssl=0 \
-Duse_system_xdg_utils=1 \
-Duse_system_yasm=1 \
-Duse_system_zlib=0 \
-Duse_gconf=0 \
-Ddisable_glibc=1 \
-Ddisable_newlib_untar=1 \
-Ddisable_sse2=1 \
-Dtarget_arch=arm \
-Darmv7=0 \
-Darmv6=1 \
-Darm_neon=0 \
-Darm_fpu=vfp \
-Darm_thumb=0 \
-Darm_neon=0 \
-Dlinux_use_tcmalloc=0 \
-Ddisable_nacl=1 \
-Dv8_use_arm_eabi_hardfloat=true \
-Dv8_can_use_vfp_instructions=false \
-Dv8_can_use_vfp2_instructions=true \
-Darm_float_abi=hard \
-Denable_webrtc=0

make chrome chrome_sandbox BUILDTYPE=Release
}

package() {
cd "$srcdir/$pkgname-$pkgver"

install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium"

install -Dm4755 -o root -g root out/Release/chrome_sandbox \
"$pkgdir/usr/lib/chromium/chromium-sandbox"

cp out/Release/{*.pak,libffmpegsumo.so} \
"$pkgdir/usr/lib/chromium/"

# Allow users to override command-line options
install -Dm644 "$srcdir/chromium.default" "$pkgdir/etc/chromium/default"

cp -a out/Release/locales "$pkgdir/usr/lib/chromium/"

install -Dm644 out/Release/chrome.1 "$pkgdir/usr/share/man/man1/chromium.1"

install -Dm644 "$srcdir/chromium.desktop" \
"$pkgdir/usr/share/applications/chromium.desktop"

for size in 22 24 48 64 128 256; do
install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done

for size in 16 32; do
install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/chromium.png"
done

install -D "$srcdir/chromium.sh" "$pkgdir/usr/bin/chromium"

install -Dm644 LICENSE "$pkgdir/usr/share/licenses/chromium/LICENSE"
}

# vim:set ts=2 sw=2 et:
')

Difference between the kmihelich's armv7 PKGBUILD and mine (so far):
$this->bbcode_second_pass_code('', '@@ -19,7 +19,7 @@
pkgver=27.0.1453.93
pkgrel=3
pkgdesc="The open-source project behind Google Chrome, an attempt at creating a safer, faster, and more stable browser"
-arch=('i686' 'x86_64')
+arch=('armv6h')
url="http://www.chromium.org/"
license=('BSD')
depends=('gtk2' 'nss' 'alsa-lib' 'xdg-utils' 'bzip2' 'libevent' 'libxss'
@@ -74,7 +74,7 @@
# Fix header location for speech-dispatcher 0.8 (patch from PLD Linux)
patch -Np2 -i "$srcdir/chromium-26.0.1410.43-speechd-0.8.patch"

- # Use Python 2
+ msg2 "Use Python 2"
find . -type f -exec sed -i -r \
-e 's|/usr/bin/python$|&2|g' \
-e 's|(/usr/bin/python2)\.4$|\1|g' \
@@ -110,7 +110,7 @@
-Dproprietary_codecs=1 \
-Duse_system_bzip2=1 \
-Duse_system_flac=1 \
- -Duse_system_ffmpeg=0 \
+ -Duse_system_ffmpeg=1 \
-Duse_system_libevent=1 \
-Duse_system_libjpeg=1 \
-Duse_system_libpng=1 \
@@ -126,12 +126,17 @@
-Ddisable_newlib_untar=1 \
-Ddisable_sse2=1 \
-Dtarget_arch=arm \
- -Darmv7=1 \
+ -Darmv7=0 \
+ -Darmv6=1 \
+ -Darm_neon=0 \
+ -Darm_fpu=vfp \
+ -Darm_thumb=0 \
-Darm_neon=0 \
- -Darm_fpu=vfpv3-d16 \
-Dlinux_use_tcmalloc=0 \
-Ddisable_nacl=1 \
-Dv8_use_arm_eabi_hardfloat=true \
+ -Dv8_can_use_vfp_instructions=false \
+ -Dv8_can_use_vfp2_instructions=true \
-Darm_float_abi=hard \
-Denable_webrtc=0
')

So far it's been over 14 hours and it's still compiling (with distcc).

-- does not build with ffmpeg (have to use "use_system_ffmpeg") files that may need to be looked at:
third_party/ffmpeg/ffmpeg.gyp
third_party/ffmpeg/chromium/scripts/build_ffmpeg.sh

In ffmpeg.gyp armv7+thumb values are hardcoded (who was coding it?!)
$this->bbcode_second_pass_code('', '['target_arch == "arm"', {
# TODO(ihf): See the long comment in build_ffmpeg.sh
# We want to be consistent with CrOS and have configured
# ffmpeg for thumb. Protect yourself from -marm.
'cflags!': [
'-marm',
],
'cflags': [
'-mthumb',
'-march=armv7-a',
'-mtune=cortex-a8',
],
# On arm we use gcc to compile the assembly.
'sources': [
'<@(asm_sources)',
],
'conditions': [
['arm_neon == 0', {
'cflags': [
'-mfpu=vfpv3-d16',
],
}, {
'cflags': [
'-mfpu=neon',
],
}],
['arm_float_abi == "hard"', {
'cflags': [
'-DHAVE_VFP_ARGS=1'
],
}, {
'cflags': [
'-DHAVE_VFP_ARGS=0'
],
}],
],
}],
')
Last edited by moonman on Wed Jun 05, 2013 11:49 am, edited 4 times in total.
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Compiling Chromium Browser for PI (Work In Progress)

Postby WarheadsSE » Fri May 31, 2013 3:24 pm

Welcome to our world. Thanks for looking into it.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Compiling Chromium Browser for PI (Work In Progress)

Postby moonman » Sat Jun 01, 2013 6:48 am

No problem. I already tried compiling it for armv5 and failed :) It did compile but wouldn't run. armv6 should be easier. (I hope)

I think there's something wrong with my Pi. It's using 700MB of swap and there's >300MB of ram free. This is 5th time I checked today and swap usage was going up and down, but ram always stayed @ 300 free. :shock:
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Compiling Chromium Browser for PI (Work In Progress)

Postby moonman » Sun Jun 02, 2013 7:50 am

It seems it's linking the final binary (chrome). Hopefully it means it (almost) successfully finished. It's been >5 hours since it started linking and over 24hours since I started compiling. swap is at 1GB usage :shock: I'm pushiing the poor thing to its max.

$this->bbcode_second_pass_code('', 'top - 01:51:22 up 1 day, 22:51, 9 users, load average: 2.11, 2.12, 2.07
Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.7 us, 5.4 sy, 0.0 ni, 0.0 id, 93.6 wa, 0.0 hi, 0.3 si, 0.0 st
KiB Mem: 472376 total, 150360 used, 322016 free, 72 buffers
KiB Swap: 1984980 total, 955356 used, 1029624 free, 7572 cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5319 root 20 0 732692 28368 180 D 2.602 6.005 19:21.58 ld
5419 root 20 0 4568 1296 992 R 1.626 0.274 0:00.21 top
54 root 20 0 0 0 0 D 1.301 0.000 48:43.93 usb-storage
3 root 20 0 0 0 0 S 0.651 0.000 23:47.24 ksoftirqd/0
142 root 20 0 1652 0 0 S 0.325 0.000 7:15.80 rngd
5398 root 20 0 0 0 0 S 0.325 0.000 0:01.84 kworker/0:0
5414 root 20 0 10344 460 332 S 0.325 0.097 0:00.64 sshd
1 root 20 0 4792 712 508 S 0.000 0.151 0:20.03 systemd ')

$this->bbcode_second_pass_code('', ' COPY out/Release/resources.pak
AR(target) out/Release/obj.target/third_party/WebKit/Source/WebKit/chromium/libwebkit.a
TOUCH out/Release/obj.target/chrome/packed_extra_resources.stamp
ACTION Generating manpage out/Release/chrome.1
CXX(target) out/Release/obj.target/chrome/chrome/app/chrome_exe_main_gtk.o
CXX(target) out/Release/obj.target/chrome/chrome/app/chrome_main.o
CXX(target) out/Release/obj.target/chrome/chrome/app/chrome_main_delegate.o
LINK(target) out/Release/chrome ')
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am

Re: Compiling Chromium Browser for PI (Work In Progress)

Postby moonman » Tue Jun 04, 2013 2:35 am

Finally compiled and it works. It's was linking for several days!

$this->bbcode_second_pass_code('', 'pacman -U http://dl.dropboxusercontent.com/u/15043728/ArchLinuxArm/RaspberryPI/chromium/chromium-27.0.1453.93-3-armv6h.pkg.tar.xz')
Pogoplug V4 | GoFlex Home | Raspberry Pi 4 4GB | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3388
Joined: Sat Jan 15, 2011 3:36 am


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 0 guests