From 0802d36a48dcd252e033a4b2ff0ecbb3719d8ac8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 15 May 2013 08:03:01 +0200 Subject: [PATCH] Revert "Revert "Fix linker library order"" This reverts commit 661805af83e2d4e7fa19432d6ae553460d6cd524. The patch was OK in the first place. Explanation: * Simon Marchi wrote: Actually, $^ here is "demo.o", not "demo. Also, the libs should appear after the objects on the command line. See the "-l" section in http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. On most setup this doesn't matter, since -Wl,--no-as-needed was the default pretty much everywhere. Ubuntu decided to use -Wl,--as-needed to avoid unnecessary dependencies, so the order becomes important. If you try to manual build on a recent Ubuntu you will get undefined references to dlopen and such. So this patch is good. If you read carefully the log sent by Alexandre, you see that it is when building the shared libs in this directory (lttng-ust-provider-ust-tests-demo.so) that the build fails. I don't know why it fails, but Alexandre hinted that passing "-fPIE -pie" to build a shared library is weird (it is usually -fPIC -pic). I am not sure where that comes from. This behaviour only happens when building the package, not when building manually. Signed-off-by: Mathieu Desnoyers --- doc/examples/demo/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile index 7ae6547e..bbc8ccb7 100644 --- a/doc/examples/demo/Makefile +++ b/doc/examples/demo/Makefile @@ -55,7 +55,7 @@ demo.o: demo.c $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< demo: demo.o - $(CC) -o $@ $(LIBS) $^ + $(CC) -o $@ $^ $(LIBS) .PHONY: clean clean: -- 2.34.1