site  contact  subhomenews

Another attempt to compile Chromium

September 21, 2021 — BarryK

Over the years, I have made a few attempts to compile Chromium. One of those, in 2019, I posted about it:

https://bkhome.org/news/201910/attempted-to-compile-chromium.html

Yesterday, thought would try again. Tried and tried to download the source from the Chromium project on github, but it kept failing. The download is huge, over 1GB, and when it failed, when unable to continue, a restart from the beginning is required. This is the case when using gn "fetch --nohooks --no-history chromium" or when using wget -- in both cases, cannot continue from the point of failure.

My contract with Vodafone is 40GB per month (on my phone), a fixed price with unlimited downloads -- but it drops to a considerably slower speed when exceed 40GB. So don't want to have too many 1GB download failures.

So I downloaded the source from the Arch Linux repo, which was a 991MB tarball, no problem downloading. Version 93.0.4577.82.

Lots of "fun and games" trying to compile it. Running EasyOS 2.9. I have OpenJDK SFS that I compiled from source, and that as well as the 'devx' SFS were loaded. For the record, here are my notes...

running easyos 2.9, with 'devx' sfs loaded.

have the jdk sfs loaded. (that i compiled myself, see input581)
...see /etc/profile.d/java

***did this in a different partition***
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# pwd
/mnt/sdb1/0-chromium
# export PATH="${PATH}:/mnt/sdb1/0-chromium/depot_tools"
******

***now in input582/0-chromium***
getting everything from arch:
https://github.com/archlinux/svntogit-packages/tree/packages/chromium/trunk

# export PATH="${PATH}:/mnt/sdb1/0-chromium/depot_tools"
# pkgname=chromium
# pkgver=93.0.4577.82
# pkgrel=2
# wget https://commondatastorage.googleapis.com/chromium-browser-official/$pkgname-$pkgver.tar.xz

# _launcher_ver=8
# _gcc_patchset=6

# wget https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz

https://github.com/stha09/chromium-patches/

# wget https://github.com/stha09/chromium-patches/archive/refs/tags/chromium-93-patchset-6.tar.gz
# tar -xf chromium-93-patchset-6.tar.gz

# tar -xf chromium-93.0.4577.82.tar.xz
# cd chromium-93.0.4577.82
# ls -1 ../chromium-patches-chromium-93-patchset-6/*.patch | xargs --replace=RRR patch -p1 --input=RRR
...some failed.

# gn gen out/Default
...failed, have to do this:

# build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
...downloads debian_sid_amd64_sysroot.tar.xz

# gn gen out/Default

this lists all of the build arguments...
# gn args out/Default --list

this brings up 'mp' editor...
# gn args out/Default

i appended:
enable_nacl = false
is_debug = false
treat_warnings_as_errors = false
is_component_build = true
symbol_level = 0
blink_symbol_level=0
link_pulseaudio=false
v8_symbol_level=0
use_sysroot=false

use_sysroot=false means will use easyos libraries, not those of the debian sysroot.

proprietary_codecs=true fails:
"proprietary codecs and ffmpeg_branding set to Chromium are incompatible"

...after saving and quiting mp, these are saved to out/Default/args.gn

Package gnome-keyring-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gnome-keyring-1.pc'
...um, but do have 'gnome-keyring' pkg, compiled in oe, version 3.34.0

ok, build it:
# tar -xf gnome-keyring-3.34.0.tar.gz
# cd gnome-keyring-3.34.0
# ./autogen.sh
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --disable-valgrind --disable-doc --enable-debug=no --disable-p11-tests --disable-selinux --disable-pam
# make
# make install
...IT ISN'T THERE...

looks like an old project...
https://gitlab.gnome.org/Archive/libgnome-keyring
...version 3.12.0
# tar -xf libgnome-keyring-3.12.0.tar.gz
# cd libgnome-keyring-3.12.0
# ./autogen.sh
You need to install gnome-common from the GNOME CVS
...crap

https://gitlab.gnome.org/GNOME/gnome-common
# tar -xf gnome-common-3.18.0.tar.gz
# cd gnome-common-3.18.0
# ./autogen.sh
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu
# make
# new2dir make install

...now go back to building libgnome-keyring...
# ./autogen.sh
checking for gtk-doc >= 1.0...
testing gtkdocize... not found.
***Error***: You must have gtk-doc >= 1.0 installed

https://gitlab.gnome.org/GNOME/gtk-doc
# tar -xf gtk-doc-GTK_DOC_1_32.tar.gz
# mv gtk-doc-GTK_DOC_1_32 gtk-doc-1.32
# cd gtk-doc-1.32
# ./autogen.sh
checking for DocBook XML DTD V4.3 in XML catalog... not found
configure: error: could not find DocBook XML DTD V4.3 in XML catalog
...i have 4.5 installed.

...isn't this fun?

https://www.linuxfromscratch.org/blfs/view/blfs-book-6.0-html/pst/xml.html
...followed instructions here, for 4.3
now back onto gtk-doc...

checking for DocBook XSL Stylesheets in XML catalog... not found
configure: error: could not find DocBook XSL Stylesheets in XML catalog

https://www.linuxfromscratch.org/blfs/view/blfs-book-6.0-html/pst/docbook-xsl.html
...followed instructions, for 1.67.2
now back onto gtk-doc...

# ./autogen.sh
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu
# new2dir make install

now back to libgnome-keyring...
# ./autogen.sh
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --enable-vala=no --enable-gtk-doc-html=no
# make
# new2dir make install

back onto chromium...
# gn args out/Default

Package wayland-client was not found in the pkg-config search path.
Perhaps you should add the directory containing `wayland-client.pc'
try these...
wayland_client_compatibility_tests = false
wayland_client_perftests = false
wayland_client_tests = false
...nup

do a quick hack...
took out those wayland options,
installed
https://packages.debian.org/bullseye/amd64/libwayland-dev/download

can we now have a go at building chromium...

ready to build...
# autoninja -C out/Default chrome
/bin/sh: ../../third_party/llvm-build/Release+Asserts/bin/clang++: No such file or directory
ninja: build stopped: subcommand failed.

# export CC=gcc
# export CXX=g++
# export AR=ar
# export NM=nm

# gn args out/Default
...added "is_clang = false"

args.gn is now:

enable_nacl = false
is_debug = false
treat_warnings_as_errors = false
is_component_build = true
symbol_level = 0
blink_symbol_level = 0
link_pulseaudio = false
v8_symbol_level = 0
use_sysroot = false
is_clang = false

off we go...
# autoninja -C out/Default chrome
...compiling!

5 minutes later...
FileNotFoundError: [Errno 2] No such file or directory: '../../third_party/node/linux/node-linux-x64/bin/node'
...got it from debian, pkg nodejs
...and deps!

another 5 minutes later...
In file included from ../../buildtools/third_party/libc++/trunk/include/cmath:308,
from ../../third_party/pdfium/core/fxcrt/fx_system.cpp:9:
../../buildtools/third_party/libc++/trunk/include/math.h: In function ‘int FXSYS_roundf(float)’:
../../buildtools/third_party/libc++/trunk/include/math.h:1617:46: error: inlining failed in call to always_inline ‘float round(float) noexcept’: function not considered for inlining
1617 | inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT
| ^~~~~
../../buildtools/third_party/libc++/trunk/include/math.h:1622:19: note: called from here
1622 | return ::round(__lcpp_x);
| ~~~~~~~^~~~~~~~~~
[2807/47943] CXX obj/third_party/pdfium/core/fxcrt/fxcrt/fx_unicode.o
ninja: build stopped: subcommand failed.

let's give it a go with the debian sysroot...
use_sysroot = true

nup...
../../build/linux/debian_sid_amd64-sysroot/usr/include/features.h:461:12: fatal error: sys/cdefs.h: No such file or directory
461 | # include <sys/cdefs.h>
| ^~~~~~~~~~~~~

...copied headers from host system, into chromium-93.0.4577.82/build/linux/debian_sid_amd64-sysroot/usr/include,
until it was off again...

File "/mnt/sda1/downloads/downloads2/input582/0-chromium/0-arch/chromium-93.0.4577.82/third_party/closure_compiler/compiler.py", line 17, in <module>
assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"
AssertionError: java only allowed in android builds
[1825/48491] CC obj/third_party/dav1d/dav1d/decode.o
ninja: build stopped: subcommand failed.

see:
https://groups.google.com/a/chromium.org/g/chromium-dev/c/SRNU3PUC-3c
edited:
chromium-93.0.4577.82/third_party/closure_compiler/compiler.py
commented-out this line:
assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"

off we go again...
# autoninja -C out/Default chrome

In file included from ../../buildtools/third_party/libc++/trunk/include/cmath:308,
from ../../third_party/pdfium/core/fxcrt/fx_system.cpp:9:
../../buildtools/third_party/libc++/trunk/include/math.h: In function ‘int FXSYS_roundf(float)’:
../../buildtools/third_party/libc++/trunk/include/math.h:1617:46: error: inlining failed in call to always_inline ‘float round(float) noexcept’: function not considered for inlining
1617 | inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT
| ^~~~~
../../buildtools/third_party/libc++/trunk/include/math.h:1622:19: note: called from here
1622 | return ::round(__lcpp_x);
| ~~~~~~~^~~~~~~~~~
[2284/46673] CXX obj/third_party/pdfium/core/fxcrt/fxcrt/fx_unicode.o

that's it, i give up.

The above is not an example of recommended compiling technique. I hacked my way through, just to see if could get that little bit further.

But the experience, plus more online reading, has given me some clues how to next tackle it.  

Tags: easy