Bug#862002: apt-cacher-ng: Please link against libatomic with --as-needed
Source: apt-cacher-ng
Version: 3-5
Severity: normal
Tags: patch
User: debian-68k@lists.debian.org
Usertags: m68k
Hello!
Currently, apt-cacher-ng fails to build from source on m68k,
powerpc, powerpcspe and sh4 because it's missing '-latomic'
from the linker options. This happens because the current
approach for passing -latomic is done based on a white-list
basis which is not the optimal approach:
# libatomic provides 8-bytes atomic operation for 32-bit MIPS
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
EXTRA_LIBS="-DEXTRA_LIBS_ACNG=-latomic"
endif
It's rather better to just use "--as-needed" and let the linker
decided whether -latomic is needed. This way, it's not longer
necessary to maintain a whitelist and adjust it for future
architectures:
EXTRA_LIBS="-DEXTRA_LIBS_ACNG=-Wl,--as-needed -latomic"
With the attached patch, apt-cacher-ng builds fine on all
affected architectures, including mips and mipsel.
Thanks,
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz@debian.org
`. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
diff -Nru apt-cacher-ng-3/debian/changelog apt-cacher-ng-3/debian/changelog
--- apt-cacher-ng-3/debian/changelog 2017-04-27 20:12:02.000000000 +0200
+++ apt-cacher-ng-3/debian/changelog 2017-05-07 11:30:17.000000000 +0200
@@ -1,3 +1,11 @@
+apt-cacher-ng (3-5.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Pass -latomic with --as-needed to linker options instead
+ of white-listing separate architectures (closes: #NNNNNN)
+
+ -- John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Sun, 07 May 2017 11:30:17 +0200
+
apt-cacher-ng (3-5) unstable; urgency=low
* Moving RequiresMountsFor to Unit section (closes: #859520)
diff -Nru apt-cacher-ng-3/debian/rules apt-cacher-ng-3/debian/rules
--- apt-cacher-ng-3/debian/rules 2017-04-27 20:12:02.000000000 +0200
+++ apt-cacher-ng-3/debian/rules 2017-05-07 11:29:49.000000000 +0200
@@ -13,10 +13,7 @@
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
-# libatomic provides 8-bytes atomic operation for 32-bit MIPS
-ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
- EXTRA_LIBS="-DEXTRA_LIBS_ACNG=-latomic"
-endif
+EXTRA_LIBS="-DEXTRA_LIBS_ACNG=-Wl,-latomic"
%:
dh $@ --parallel --with systemd
Reply to: