Source: libapache2-mod-ldap-userdir
Version: 1.1.19-2.2
Severity: normal
Tags: patch ftbfs
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: origin-ubuntu stonking
Hi,
libapache2-mod-ldap-userdir fails to build when LTO is enabled in the
default build flags (e.g. DEB_BUILD_MAINT_OPTIONS=optimize=+lto). Ubuntu
enables LTO by default on most architectures, so we hit it there:
apxs -c -Wdate-time -D_FORTIFY_SOURCE=3 -Wl,-Bsymbolic-functions ... \
-flto=auto -ffat-lto-objects -Wl,-z,relro ... mod_ldap_userdir.c
apxs:Error: Unknown option: f.
apxs:Error: Unknown option: t.
apxs:Error: Unknown option: -.
make[2]: *** [Makefile:10: .libs/mod_ldap_userdir.so] Error 1
Ubuntu build log:
https://launchpad.net/ubuntu/+source/libapache2-mod-ldap-userdir/1.1.19-2.2/+build/32793477
Makefile.in passes the build flags directly to apxs:
$(APXS) -c $(CPPFLAGS) $(LDFLAGS) $(LIBS) $(TLS) mod_ldap_userdir.c
apxs only accepts compiler/linker flags wrapped as -Wc,... or -Wl,....
The -Wl,-prefixed parts of LDFLAGS work, but bare flags such as
-flto=auto and -ffat-lto-objects are parsed by apxs as unknown options.
Since 1.1.19-2.2 switched to a plain dh sequence (#989941),
dh_auto_configure passes the full LDFLAGS to configure, so any LTO flags
in LDFLAGS now break the build. It builds in Debian today only because
Debian does not enable LTO by default.
Upstream (https://github.com/jwm/mod_ldap_userdir) has had no commits
since the 1.1.19 release in 2012, so I'm reporting it here rather than
upstream.
The minimal fix is to disable LTO for this package (debian-rules.diff,
attached):
-export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-branch
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-branch optimize=-lto
A more thorough fix would be to patch Makefile.in so that flags apxs does
not understand natively are passed in -Wc,/-Wl, form, or to filter
LDFLAGS so that only -L/-l/-Wl, entries reach apxs directly.
Note: the diff has not been test-built yet.
Thanks,
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500,
'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-38-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.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
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
-export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-branch
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-branch optimize=-lto
%:
dh $@ --with apache2