Package: chromium
Version: 111.0.5563.64-1
Severity: minor

I've been experimenting with building the latest Debian chromium package
on Ubuntu 22.04, and in the course of that have found a couple of minor
issues in the debian/rules file:

* The flags added by optimize=+lto in DEB_BUILD_MAINT_OPTIONS will
  cause every compile invocation to print "optimization flag
  '-ffat-lto-objects' is not supported" warnings (as the dpkg LTO flags
  are meant for GCC, not Clang), and balloon the RAM required for the
  final link from ~2.5 GB to ~30 GB. The link will also require much
  more time to complete; on my fairly beefy test system, it went from
  under a minute to four hours.

  Disabling this explicitly before Debian enables LTO system-wide would
  be a good move, in my view. On Ubuntu, LTO is already the default, and
  without adding this bit, the package is difficult to build in their
  infrastructure due to the resource requirements.

* LDFLAGS is set without obtaining an initial value from
  dpkg-buildflags(1).

The attached patch addresses both issues.

Side note: You may want to consider enabling ThinLTO, by setting
use_thin_lto=true and unsetting concurrent_links. The final link
requires only ~10.5 GB RAM, and completes within minutes.


--Daniel


-- 
Daniel Richard G. || sk...@iskunk.org
My ASCII-art .sig got a bad case of Times New Roman.
--- chromium-111.0.5563.64/debian/rules.orig	2023-03-02 01:24:58.000000000 +0000
+++ chromium-111.0.5563.64/debian/rules	2023-03-15 08:15:54.485885154 +0000
@@ -6,6 +6,9 @@
 # enable all build hardening flags
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
+# disable lto flags, as they are for gcc, not clang
+export DEB_BUILD_MAINT_OPTIONS+=optimize=-lto
+
 # indicate that binary targets do not require root
 export DEB_RULES_REQUIRES_ROOT=no
 
@@ -15,12 +18,13 @@
 export CC=clang
 export CXX=clang++
 
-# more verbose linker output
-export LDFLAGS+=-Wl,--stats
-
 # initial flags from dpkg-buildflags
 export DEB_CXXFLAGS_MAINT_STRIP=-g
 export CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS)
+export LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
+
+# more verbose linker output
+export LDFLAGS+=-Wl,--stats
 
 # extra flags to reduce warnings that aren't very useful
 export CXXFLAGS+=-Wno-conversion \

Reply via email to