Revert "Revert "Fix (another) linker library order""
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 15 May 2013 06:03:56 +0000 (08:03 +0200)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 15 May 2013 06:03:56 +0000 (08:03 +0200)
This reverts commit a5b31eab4e1f190d68d51c47dabb60b64ee471e7.

The patch was OK in the first place. Explanation:

* Simon Marchi <simon.marchi@polymtl.ca> 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 <mathieu.desnoyers@efficios.com>
doc/examples/hello-static-lib/Makefile

index a5bf2df1a6b32fdb5ff5e62f7ce52a5a002b79a5..dd246f70a5c274dd465f18cf025e57b5bc678e17 100644 (file)
@@ -46,7 +46,7 @@ hello.o: hello.c
        $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 hello: hello.o lttng-ust-provider-hello.a
-       $(CC) -o $@ $(LDFLAGS) $(LIBS) $^
+       $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
 
 .PHONY: clean
 clean:
This page took 0.024921 seconds and 4 git commands to generate.