chromium-browser 63+ packages 50+ MB of binaries only needed at build time

Bug #1742653 reported by Mario Sánchez Prada on 2018-01-11
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
chromium-browser (Ubuntu)
High
Olivier Tilloy

Bug Description

As mentioned in [1], it seems like the chromium-browser package might be, since Chromium 63, packaging a new and pretty big (44MB) binary that is not needed at run time, just at build time.

This binary is `/usr/lib/chromium-browser/v8_context_snapshot_generator`, which is at the moment being packaged (see file list for bionic in [2]) in the chromium-browser package along with the 1MB related binary that is the only one that should be included in the package:
```
$ ls -ltrh /usr/lib/chromium-browser/v8_context_snapshot*
-rwxr-xr-x 1 root root 44M Jan 9 18:21 /usr/lib/chromium-browser/v8_context_snapshot_generator
-rw-r--r-- 1 root root 1.6M Jan 9 18:21 /usr/lib/chromium-browser/v8_context_snapshot.bin
```

This can become a big deal in space-constrained installations, of course, but considering that the installed size of the package is ~260MB, this binary alone accounts for ~16% of the package's size, so it would be good to clean that up from the package if possible.

[1] https://askubuntu.com/questions/986031/why-is-chromium-browser-63-so-much-bigger-than-62/986132
[2] https://packages.ubuntu.com/bionic/amd64/chromium-browser/filelist
[3] https://docs.google.com/document/d/1jpQQX0piaxcHJPWakp_Kr_03g5Gnma5h5-Kdlqu7jVQ/edit#heading=h.k6iklq6rvd30

Mario Sánchez Prada (mariospr) wrote :

I believe all it's needed is to patch the debian/rules file to add `v8_context_snapshot_generator` to the TRASH list of files:
```
--- a/debian/rules 2017-12-07 08:40:06.000000000 +0000
+++ b/debian/rules 2018-01-11 10:59:39.168190995 +0000
@@ -219,7 +219,7 @@
 override_dh_install-arch: T := verify-install-integrity-dep
 override_dh_install-arch: SPACE := $(eval) $(eval)
 override_dh_install-arch: S_CR_PATH := apps/chromium/current
-override_dh_install-arch: TRASH := .deps gen obj obj.host obj.target \*.lock build.\* .landmines mksnapshot\* protoc pyproto re2c resources yasm \*.TOC product_logo_\*png gen\* lib/\* lib libvpx_obj_int_extract .ninja\* chrome-wrapper \*.breakpad.\* java_mojo dump_syms browser_test_resources ar_sample_test_driver unittests app_streaming/dev locales remoting_locales
+override_dh_install-arch: TRASH := .deps gen obj obj.host obj.target \*.lock build.\* .landmines mksnapshot\* protoc pyproto re2c resources yasm \*.TOC product_logo_\*png gen\* lib/\* lib libvpx_obj_int_extract .ninja\* chrome-wrapper \*.breakpad.\* java_mojo dump_syms browser_test_resources ar_sample_test_driver unittests app_streaming/dev locales remoting_locales v8_context_snapshot_generator
 override_dh_install-arch: debian/chromium-browser.sh
 override_dh_install-arch:
  # Two stages: Install out of source tree. Copy to packaging.
```

That said, if we're to update that TRASH list, I'd recommend adding a few more files to that list that we (Endless) found useful to reduce the size of the resulting package even more, since those are only used for building as well, and take up quite some space too (e.g. toolchain.ninja is 5 MB, gn binary is 2.5 MB...).

Thus, the full list of targets I'm proposing to add to TRASH is this:
  - v8_build_config.json
  - v8_context_snapshot_generator
  - args.gn
  - gn
  - *.ninja

This would reduce the size of the installed binary in a bit over 51MB in total, not bad :-). FWIW, we had those additional targets added to TRASH in our chromium-browser package for a while already, not sure why we didn't reported that before, sorry about that.

See attached the patch implementing this proposal

summary: - chromium-browser 63+ package includes a 44MB binary only needed at build
+ chromium-browser 63+ packages 51+ MB of binaries only needed at build
time
summary: - chromium-browser 63+ packages 51+ MB of binaries only needed at build
+ chromium-browser 63+ packages 50+ MB of binaries only needed at build
time

The attachment "Save 50+ MB by avoiding packaging build only files" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Olivier Tilloy (osomon) wrote :

Thanks for the report Mario. I verified that those files can be safely removed from the binary package indeed. Good catch!

Changed in chromium-browser (Ubuntu):
status: New → Confirmed
assignee: nobody → Olivier Tilloy (osomon)
importance: Undecided → High
Olivier Tilloy (osomon) on 2018-01-11
Changed in chromium-browser (Ubuntu):
status: Confirmed → In Progress
Mario Sánchez Prada (mariospr) wrote :

No problem, happy to see the report and the patch are useful.

After all, shaving 50MB out of 260MB is quite something! :)

Olivier Tilloy (osomon) on 2018-01-24
Changed in chromium-browser (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package chromium-browser - 63.0.3239.132-0ubuntu0.14.04.1

---------------
chromium-browser (63.0.3239.132-0ubuntu0.14.04.1) trusty; urgency=medium

  * Upstream release: 63.0.3239.132
  * debian/rules: do not install files used for building only (LP: #1742653)

 -- Olivier Tilloy <email address hidden> Sun, 14 Jan 2018 21:37:42 +0100

Changed in chromium-browser (Ubuntu):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package chromium-browser - 63.0.3239.132-0ubuntu0.17.10.2

---------------
chromium-browser (63.0.3239.132-0ubuntu0.17.10.2) artful; urgency=medium

  * debian/rules: do not install files used for building only (LP: #1742653)

 -- Olivier Tilloy <email address hidden> Thu, 11 Jan 2018 17:08:05 +0100

Changed in chromium-browser (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers