[Pkg-chromium-maint] Bug#765169: Chromium component build succeeds on i686

Mikko Rapeli mikko.rapeli at iki.fi
Wed Oct 15 19:18:51 UTC 2014


Just for completeness:

I heard from some developers that Chromium has a component build option
which creates multiple .so's from included sources instead of one big
executable.

This is documented at http://www.chromium.org/developers/how-tos/component-build

Unfortunately https://code.google.com/p/chromium/wiki/LinuxBuildInstructions
says that:

"Linker Crashes
If, during the final link stage:

  LINK(target) out/Debug/chrome
You get an error like:

collect2: ld terminated with signal 6 Aborted terminate called after throwing an instance of 'std::bad_alloc'

collect2: ld terminated with signal 11 [Segmentation fault], core dumped 
you are probably running out of memory when linking. Try one of:

Use the gold linker
Build on a 64-bit computer
Build in Release mode (debugging symbols require a lot of memory)
Build as shared libraries (note: this build is for developers only, and may have broken functionality)"

Anyway, I gave it a try. Debian packaging changes I use, also include
switch to ld.gold and ccache compiler cache to speed up rebuilds:

--- tmp/debian/chromium.install 2014-10-10 03:49:16.000000000 +0200
+++ chromium-browser-38.0.2125.101/debian/chromium.install      2014-10-15 14:33:22.060233798 +0200
@@ -2,10 +2,12 @@ out/Release/chromium usr/lib/chromium
 out/Release/chrome-sandbox usr/lib/chromium

 out/Release/*.so usr/lib/chromium
+out/Release/lib/*.so usr/lib/chromium
 out/Release/*.pak usr/lib/chromium
 out/Release/icudtl.dat usr/lib/chromium

-out/Release/resources/*.pak usr/lib/chromium/locales
+out/Release/locales/*.pak usr/lib/chromium/locales
+out/Release/pseudo_locales/*.pak usr/lib/chromium/locales

 debian/presubj usr/share/bug/chromium

iff -rup tmp/debian/rules chromium-browser-38.0.2125.101/debian/rules
--- tmp/debian/rules    2014-10-10 05:52:39.000000000 +0200
+++ chromium-browser-38.0.2125.101/debian/rules 2014-10-15 14:06:21.151701940 +0200
@@ -1,16 +1,19 @@
 #!/usr/bin/make -f

 # enable verbose build messages
-export DH_VERBOSE=1
+DH_VERBOSE=1
+
+CC := ccache clang
+CXX := ccache clang++

 # enable all build hardening flags
-export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+DEB_BUILD_MAINT_OPTIONS=hardening=+all

-# linker flags to avoid memory allocation issues on i386
-export LDFLAGS+=-Wl,--no-keep-memory -Wl,--reduce-memory-overheads -Wl,--hash-size=7919
+# linker flags to avoid memory allocation issues on i386, use ld.gold instead
+LDFLAGS+=-fuse-ld=gold

 # more verbose linker output
-export LDFLAGS+=-Wl,--trace -Wl,--stats
+LDFLAGS+=-Wl,--trace -Wl,--stats

 # treat all warnings as errors
 defines=werror=
@@ -41,6 +44,7 @@ defines+=enable_hidpi=1 \
          linux_link_gsettings=1 \
          linux_link_libspeechd=1 \
          linux_link_gnome_keyring=1 \
+         component=shared_library \

 # system libraries to use
 defines+=use_system_re2=1 \
@@ -100,7 +105,9 @@ flotpaths=/usr/share/javascript/jquery/*

 override_dh_auto_configure:
        for file in $(flotpaths); do ln -sf $$file third_party/flot; done
+       CC="${CC}" CXX="${CXX}" LDFLAGS="${LDFLAGS}" \
        GYP_DEFINES="$(defines)" ./build/gyp_chromium $(options)
+       CC="${CC}" CXX="${CXX}" LDFLAGS="${LDFLAGS}" \

 override_dh_auto_build:
        ninja $(njobs) -C out/Release chrome chrome_sandbox chromedriver
@@ -124,6 +131,10 @@ override_dh_fixperms:
 override_dh_strip:
        dh_strip --dbg-package=chromium-dbg

+override_dh_shlibdeps:
+       # exclude the internal libs which miss proper SONAME etc
+       dh_shlibdeps -Xusr/lib/chromium/lib/ -- -ldebian/chromium/usr/lib/chromium/ -ldebian/chromium/usr/lib/chromium/lib/
+
 override_dh_auto_clean:
        rm -rf out Makefile third_party/flot/*
        rm -rf out Makefile third_party/flot/*
        find . -name \*.mk -execdir rm -rf {} \;

With these changes chromium builds on i686 but running the binary with the
new shared objects fails:

~/src/chromium-browser-38.0.2125.101/out/Release$ LD_LIBRARY_PATH=.:./lib ./chromium 
[libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already exists in database: phonenumber.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1018] CHECK failed: generated_database_->Add(encoded_file_descriptor, size): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: generated_database_->Add(encoded_file_descriptor, size): 
Aborted

This bug report is likely not cared by upstream or Debian packagers but maybe
someone cares about natively building chromium on 32bit archs.

My journey into chromium land ends here :)

-Mikko



More information about the Pkg-chromium-maint mailing list