Skip to contentSkip to conversation

openswan: disable for static builds

PATCH New Vicente Olivert Riera 2 participants 2 messages Mar 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openswan: disable for static builds

openswan is built with -fPIE which produces shared objects, and shared objects need "/lib/ld.so" which won't be present on a statically built target. So, building openswan with -static -fPIE is invalid and will fail with an error like this one:

/br/output/host/opt/ext-toolchain/bin/../lib/gcc/mipsel-ctng-linux-uclibc/4.8.2/../../../../mipsel-ctng-linux-uclibc/bin/ld:
/br/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libgmp.a(lt2-add.o):
relocation R_MIPS_HI16 against `__gnu_local_gp' can not be used when
making a shared object; recompile with -fPIC

Fixes:

http://autobuild.buildroot.net/results/68b/68b2211cc7acfbdfed8d4b161cbdaf1429315017/

---
 package/openswan/Config.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
package/openswan/Config.in +4 -0
index 932a75f..1ad255e 100644
@@ -1,9 +1,13 @@
 config BR2_PACKAGE_OPENSWAN
 	bool "openswan"
 	depends on BR2_USE_MMU # iproute2
+	depends on !BR2_STATIC_LIBS # -static -fPIE is invalid
 	select BR2_PACKAGE_GMP
 	select BR2_PACKAGE_IPROUTE2
 	help
 	  Openswan is an implementation of IPsec for Linux
 
 	  http://www.openswan.org
+
+comment "openswan needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 openswan: disable for static builds

Dear Vicente Olivert Riera,

Quoted 4 lines · Vicente Olivert Riera

openswan is built with -fPIE which produces shared objects, and shared objects need "/lib/ld.so" which won't be present on a statically built target. So, building openswan with -static -fPIE is invalid and will fail with an error like this one:

Did you see that -fPIE is in fact explicitly passed by Buildroot in openswan.mk ? So most likely, all what you need to do is to make sure to pass -fPIE only if BR2_STATIC_LIBS is disabled.

I'll mark this patch as Changes Requested in patchwork. Please submit a new version that doesn't pass -fPIE when not needed.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com