[Pkg-cmake-team] Bug#1034873: cmake: FTBFS with LTO enabled on many architectures

Lukas Märdian slyon at ubuntu.com
Wed Apr 26 11:52:04 BST 2023


Package: cmake
Version: 3.25.1-1
Severity: minor
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu  ubuntu-patch
X-Debbugs-Cc: slyon at ubuntu.com

Dear Maintainer,

cmake fails to execute its buildtime tests (dh_auto_test) on many
architectures when compiled with an LTO enabled toolchain. E.g. on
Ubuntu/s390x (GCC-12 + LTO) we saw the following failure:

# CustomCommand test fails (LP: #2015872):
#   No INFO:symbol[pcStatic] found in: /<<PKGBUILDDIR>>/Build/Tests/CustomCommand/bin/libpcStatic.a
# Instead it produces the following strings (`strings bin/libpcStatic.a | grep INFO`):
#   INFO:symbol[]
#   INFO:symbol[pcStatic]

We also observed failures on amd64, arm64 and ppc64el in addition to s390x:
https://git.launchpad.net/ubuntu/+source/lto-disabled-list/commit/?h=ubuntu/devel&id=57f7f783

This does not directly affect Debian, but might, should Debian enable LTO by
default in the future. Please consider disabling LTO explicitly to avoid such
(future) failure, or feel free to reject this patch if you feel like it doesn't
apply.

  * d/rules: Disable LTO to fix FTBFS (LP: #2015872)


Thanks for considering the patch.

-- Lukas


-- System Information:
Debian Release: bookworm/sid
  APT prefers jammy-updates
  APT policy: (500, 'jammy-updates'), (500, 'jammy-security'), (500, 'jammy'), (100, 'jammy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.19.0-38-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru cmake-3.25.1/debian/rules cmake-3.25.1/debian/rules
--- cmake-3.25.1/debian/rules	2022-11-30 20:56:26.000000000 +0100
+++ cmake-3.25.1/debian/rules	2023-04-11 15:05:40.000000000 +0200
@@ -2,6 +2,14 @@
 
 include /usr/share/dpkg/pkg-info.mk
 
+# LTO makes the cmake build FTBFS on many architectures:
+# https://git.launchpad.net/ubuntu/+source/lto-disabled-list/commit/?h=ubuntu/devel&id=57f7f783
+# E.g. on s390x it makes the CustomCommand test fail (LP: #2015872):
+#   No INFO:symbol[pcStatic] found in: /<<PKGBUILDDIR>>/Build/Tests/CustomCommand/bin/libpcStatic.a
+# Instead it produces the following strings (`strings bin/libpcStatic.a | grep INFO`):
+#   INFO:symbol[]
+#   INFO:symbol[pcStatic]
+export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
 export DEB_CXXFLAGS_MAINT_APPEND := $(shell dpkg-buildflags --get CPPFLAGS)
 export DEB_CFLAGS_MAINT_APPEND := $(shell dpkg-buildflags --get CPPFLAGS)
 export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed


More information about the Pkg-cmake-team mailing list