Bug#897639: lintian: testsuite fails when ld is configured with --as-needed by default
Package: lintian
Version: 2.5.84
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch
In Ubuntu, the attached patch was applied to achieve the following:
* Sprinkle -Wl,--no-as-needed around to fix test failures with our ld.
The patch should be, I hope, mostly self-explanatory. To see the
effects, here are the before and after build logs:
[fail] https://launchpad.net/ubuntu/+source/lintian/2.5.84ubuntu1/+build/14817753/+files/buildlog_ubuntu-cosmic-amd64.lintian_2.5.84ubuntu1_BUILDING.txt.gz
[pass] https://launchpad.net/ubuntu/+source/lintian/2.5.84ubuntu2/+build/14821606/+files/buildlog_ubuntu-cosmic-amd64.lintian_2.5.84ubuntu2_BUILDING.txt.gz
... Adam
-- System Information:
Debian Release: buster/sid
APT prefers cosmic
APT policy: (500, 'cosmic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.15.0-20-lowlatency (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru lintian-2.5.84ubuntu1/t/tests/binaries-missing-depends-on-numpy-abi/debian/debian/rules lintian-2.5.84ubuntu2/t/tests/binaries-missing-depends-on-numpy-abi/debian/debian/rules
--- lintian-2.5.84ubuntu1/t/tests/binaries-missing-depends-on-numpy-abi/debian/debian/rules 2018-04-23 05:50:51.000000000 -0600
+++ lintian-2.5.84ubuntu2/t/tests/binaries-missing-depends-on-numpy-abi/debian/debian/rules 2018-05-03 09:15:40.000000000 -0600
@@ -1,6 +1,7 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
+export DEB_LDFLAGS_MAINT_APPEND=-Wl,--no-as-needed
%:
dh $@
diff -Nru lintian-2.5.84ubuntu1/t/tests/legacy-libbaz/debian/Makefile lintian-2.5.84ubuntu2/t/tests/legacy-libbaz/debian/Makefile
--- lintian-2.5.84ubuntu1/t/tests/legacy-libbaz/debian/Makefile 2018-04-23 05:50:51.000000000 -0600
+++ lintian-2.5.84ubuntu2/t/tests/legacy-libbaz/debian/Makefile 2018-05-03 09:20:56.000000000 -0600
@@ -2,6 +2,7 @@
CC=gcc
CFLAGS=-g -Wall -Winline -O2
+LDFLAGS=-Wl,--no-as-needed
OBJS=baz.o extra.o
SHOBJS=baz.sho extra.sho
@@ -17,27 +18,27 @@
# Oops, forget the soname altogether
libbaz1.so.1.0.3b: $(NOPICOBJS)
- $(CC) -o $@ -shared $^ -lc
+ $(CC) $(LDFLAGS) -o $@ -shared $^ -lc
libbaz2.so.1.0.3b: $(SHOBJS)
- $(CC) -o $@ -shared -Wl,-soname,libbaz2.so.1.0 $^ -lc
+ $(CC) $(LDFLAGS) -o $@ -shared -Wl,-soname,libbaz2.so.1.0 $^ -lc
# Non-PIC. We can't test this on all architectures
libbaz3.so.1.0.3b: $(NOPICOBJS)
- $(CC) -o $@ -shared -Wl,-soname,libbaz3.so.1 $^ -lc
+ $(CC) $(LDFLAGS) -o $@ -shared -Wl,-soname,libbaz3.so.1 $^ -lc
# Non-versioned SONAME.
libbaz.so: $(SHOBJS)
- $(CC) -o $@ -shared -Wl,-soname,libbaz.so $^ -lc
+ $(CC) $(LDFLAGS) -o $@ -shared -Wl,-soname,libbaz.so $^ -lc
#%.o-noreentrant: %.c
-# $(CC) $(CFLAGS) -o $@ -c $<
+# $(CC) $(LDFLAGS) $(CFLAGS) -o $@ -c $<
%.sho: %.c
- $(CC) $(CFLAGS) -D_REENTRANT -fPIC -o $@ -c $<
+ $(CC) $(LDFLAGS) $(CFLAGS) -D_REENTRANT -fPIC -o $@ -c $<
%.o: %.c
- $(CC) $(CFLAGS) -D_REENTRANT -o $@ -c $<
+ $(CC) $(LDFLAGS) $(CFLAGS) -D_REENTRANT -o $@ -c $<
libbaz2.a: $(OBJS)
ar cq $@ $(OBJS)
diff -Nru lintian-2.5.84ubuntu1/t/tests/usrmerge-lib/debian/Makefile lintian-2.5.84ubuntu2/t/tests/usrmerge-lib/debian/Makefile
--- lintian-2.5.84ubuntu1/t/tests/usrmerge-lib/debian/Makefile 2018-04-23 05:50:51.000000000 -0600
+++ lintian-2.5.84ubuntu2/t/tests/usrmerge-lib/debian/Makefile 2018-05-03 09:17:26.000000000 -0600
@@ -1,5 +1,5 @@
all:
- gcc $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-z,defs -Wl,-soname,libbasic.so.2 -o libbasic.so.2 basic.c
+ gcc $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -fPIC -shared -Wl,--no-as-needed -Wl,-z,defs -Wl,-soname,libbasic.so.2 -o libbasic.so.2 basic.c
install:
# install it under the correct triplet directory
Reply to: