Linking 'stdbuf.so' failed with gcc-5.0 on x86_64 when -fpie
compilation was enabled which includes -fno-PIC.

  ld: src/src_libstdbuf_so-libstdbuf.o: relocation R_X86_64_PC32 \
  against undefined symbol `stderr@@GLIBC_2.2.5' can not be \
  used when making a shared object; recompile with -fPIC

* src/local.mk (src_libstdbuf_so_CFLAGS): Explicitly choose the options
"-fno-pie -fPIC" for the compilation of "stdbuf.c".
---
 src/local.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/local.mk b/src/local.mk
index 19152f0..60ba3c7 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -406,8 +406,10 @@ src_libstdbuf_so_LDADD = $(LIBINTL)
 # Note libstdbuf is only compiled if GCC is available
 # (as per the check in configure.ac), so these flags should be available.
 # libtool is probably required to relax this dependency.
+# As a given -fpie option may implicitly include -fno-PIC
+# (e.g. on gcc-5.0), explicitly choose PIC compilation.
 src_libstdbuf_so_LDFLAGS = -shared
-src_libstdbuf_so_CFLAGS = -fPIC $(AM_CFLAGS)
+src_libstdbuf_so_CFLAGS = $(AM_CFLAGS) -fno-pie -fPIC
 
 BUILT_SOURCES += src/coreutils.h
 if SINGLE_BINARY
-- 
2.1.4


Reply via email to