git » libfiu » commit fe9d37d

Move libraries after files that need them to fix FTBFS with ld --as-needed.

author Logan Rosen
2015-08-17 00:21:43 UTC
committer Alberto Bertogli
2016-11-17 12:48:54 UTC
parent 444eab653f6056256a081c9f48426638d7977c4b

Move libraries after files that need them to fix FTBFS with ld --as-needed.

[ Alberto's notes follow ]

FTBFS means "Fails To Build From Source", https://wiki.debian.org/FTBFS.

This patch fixes the build when "--as-needed" is passed to the linker.
The problem can be reproduced by running:

  make CFLAGS=-Wl,--as-needed clean test

The --as-needed linker option is used when building packages for some
distributions, notably Debian and Ubuntu.

The patch was written by Logan Rosen, who applied the patch to Ubuntu's
package, the original can be found at:
http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/libfiu/wily/revision/20

Chris Lamb applied it to Debian's package, and told me about it so I
could merge it directly (which I'm doing now :).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819373
https://github.com/lamby/pkg-libfiu/commit/f8cc48a0f5cc45454ac5ef3d59725e751abe3833

Thanks a lot to both!

tests/Makefile +2 -2

diff --git a/tests/Makefile b/tests/Makefile
index ad754ac..c4a63ed 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -64,8 +64,8 @@ test-%: test-%.c build-flags
 #    direct jumps, which leaves caller information out of the stack frame and
 #    makes functions not appear in the backtrace. We disable it.
 test-enable_stac%: test-enable_stac%.c build-flags
-	$(NICE_CC) $(ALL_CFLAGS) -lfiu -lpthread \
-		-rdynamic -fno-optimize-sibling-calls $< -o $@
+	$(NICE_CC) $(ALL_CFLAGS) \
+		-rdynamic -fno-optimize-sibling-calls $< -lfiu -lpthread -o $@
 
 c-run-%: %
 	$(NICE_RUN) ./$<