diff mbox

[2/2] package/aespipe: fix host compile

Message ID 20170703084107.5620-2-arnout@mind.be
State Accepted
Headers show

Commit Message

Arnout Vandecappelle July 3, 2017, 8:41 a.m. UTC
From: Bernd Kuhls <bernd.kuhls@t-online.de>

Building host-aespipe fails on Debian stretch at linking stage:

/usr/bin/gcc -L/home/buildroot/br6/output/host/lib -L/home/buildroot/br6/output/host/usr/lib -Wl,-rpath,/home/buildroot/br6/output/host/usr/lib -o aespipe aespipe.o aes-amd64.o md5-amd64.o md5-2x-amd64.o aes-intel64.o sha512.o rmd160.o
/usr/bin/ld: aes-amd64.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

The same problem apparently exists on recent Ubuntu and Gentoo.

Fix is also used in Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393

[Peter: add comment explaining why]
[Arnout: use host-cc-option to discover if -no-pie is available;
 cfr. 57b628a932b9b4a3c4bf80f4c82a81da5adcb173]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 package/aespipe/aespipe.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Peter Korsgaard July 25, 2017, 10:14 p.m. UTC | #1
>>>>> "Arnout" == Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> writes:

 > From: Bernd Kuhls <bernd.kuhls@t-online.de>
 > Building host-aespipe fails on Debian stretch at linking stage:

 > /usr/bin/gcc -L/home/buildroot/br6/output/host/lib
 > -L/home/buildroot/br6/output/host/usr/lib
 > -Wl,-rpath,/home/buildroot/br6/output/host/usr/lib -o aespipe
 > aespipe.o aes-amd64.o md5-amd64.o md5-2x-amd64.o aes-intel64.o
 > sha512.o rmd160.o
 > /usr/bin/ld: aes-amd64.o: relocation R_X86_64_32S against `.rodata'
 > can not be used when making a shared object; recompile with -fPIC

 > The same problem apparently exists on recent Ubuntu and Gentoo.

 > Fix is also used in Debian:
 > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393

 > [Peter: add comment explaining why]
 > [Arnout: use host-cc-option to discover if -no-pie is available;
 >  cfr. 57b628a932b9b4a3c4bf80f4c82a81da5adcb173]
 > Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
 > Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
 > Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Committed to 2017.02.x and 2017.05.x, thanks.
diff mbox

Patch

diff --git a/package/aespipe/aespipe.mk b/package/aespipe/aespipe.mk
index 6a38556ef1..5ef95d5206 100644
--- a/package/aespipe/aespipe.mk
+++ b/package/aespipe/aespipe.mk
@@ -9,5 +9,15 @@  AESPIPE_SOURCE = aespipe-v$(AESPIPE_VERSION).tar.bz2
 AESPIPE_SITE = http://loop-aes.sourceforge.net/aespipe
 AESPIPE_LICENSE = GPL
 
+# Recent Debian, Gentoo and Ubuntu enable -fPIE by default, breaking the build:
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837393
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835148
+# Older gcc versions however don't support the -no-pie flag, so we have to
+# check its availability.
+HOST_AESPIPE_NO_PIE_FLAG = $(call host-cc-option,-no-pie)
+HOST_AESPIPE_CONF_ENV = \
+	CFLAGS="$(HOST_CFLAGS) $(HOST_AESPIPE_NO_PIE_FLAG)" \
+	LDFLAGS="$(HOST_LDFLAGS) $(HOST_AESPIPE_NO_PIE_FLAG)"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))