Source: ustr
Version: 1.0.4-5
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

ustr fails to build from source on architectures where PIE is not
enabled by default (such as m68k, powerpc or x32). On those
architectures, LDFLAGS as generated by dpkg-buildflags contain -pie.
When ustr links the shared library it passes -shared before $(LDFLAGS)
and thus -pie takes precedence. The link step fails finding the main
function. Swapping the -shared and $(LDFLAGS) makes the build successful
again.

Helmut
diff --minimal -Nru ustr-1.0.4/debian/changelog ustr-1.0.4/debian/changelog
--- ustr-1.0.4/debian/changelog 2015-06-09 15:11:01.000000000 +0200
+++ ustr-1.0.4/debian/changelog 2016-11-06 19:51:22.000000000 +0100
@@ -1,3 +1,10 @@
+ustr (1.0.4-5.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTBFS: pie.patch: move LDFLAGS before -shared. Closes: #-1
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sun, 06 Nov 2016 19:51:22 +0100
+
 ustr (1.0.4-5) unstable; urgency=low
 
   * Fixed transition from the doc directory to a symlink
diff --minimal -Nru ustr-1.0.4/debian/patches/pie.diff 
ustr-1.0.4/debian/patches/pie.diff
--- ustr-1.0.4/debian/patches/pie.diff  1970-01-01 01:00:00.000000000 +0100
+++ ustr-1.0.4/debian/patches/pie.diff  2016-11-06 19:51:22.000000000 +0100
@@ -0,0 +1,21 @@
+Subject: -pie must come before -shared
+From: Helmut Grohne <hel...@subdivi.de>
+
+Index: ustr-1.0.4/Makefile.in
+===================================================================
+--- ustr-1.0.4.orig/Makefile.in
++++ ustr-1.0.4/Makefile.in
+@@ -507,11 +507,11 @@
+ # Use LDFLAGS for LDFLAGS="-m32"
+ $(OPT_LIB_SHARED): $(LIB_SHARED_OPT)
+               $(if $(HIDE), @echo Linking SO OPT lib: $@)
+-              $(HIDE)$(CC) -shared $^ -Wl,-soname -Wl,$(OPT_LIB_SHARED_NAME) 
-Wl,-version-script -Wl,libustr.ver $(LDFLAGS) -o $@
++              $(HIDE)$(CC) $(LDFLAGS) -shared $^ -Wl,-soname 
-Wl,$(OPT_LIB_SHARED_NAME) -Wl,-version-script -Wl,libustr.ver -o $@
+ 
+ $(DBG_LIB_SHARED): $(LIB_SHARED_DBG)
+               $(if $(HIDE), @echo Linking SO DBG lib: $@)
+-              $(HIDE)$(CC) -shared $^ -Wl,-soname -Wl,$(DBG_LIB_SHARED_NAME) 
-Wl,-version-script -Wl,libustr.ver $(LDFLAGS) -o $@
++              $(HIDE)$(CC) $(LDFLAGS) -shared $^ -Wl,-soname 
-Wl,$(DBG_LIB_SHARED_NAME) -Wl,-version-script -Wl,libustr.ver -o $@
+ 
+ libustr.a: $(LIB_STATIC_OPT)
+               $(if $(HIDE), @echo Linking A OPT lib: $@)
diff --minimal -Nru ustr-1.0.4/debian/patches/series 
ustr-1.0.4/debian/patches/series
--- ustr-1.0.4/debian/patches/series    2015-06-09 15:10:54.000000000 +0200
+++ ustr-1.0.4/debian/patches/series    2016-11-06 19:50:56.000000000 +0100
@@ -6,3 +6,4 @@
 fixes/nonlinux.diff -p1
 fixes/stdarg-va_copy.diff -p1
 fixes/unused-vars.diff -p1
+pie.diff

Reply via email to