Fix: test_seek static linking
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Aug 2013 17:28:13 +0000 (13:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Aug 2013 17:28:13 +0000 (13:28 -0400)
./configure --disable-shared --enable-static
make
make check

The make check fails for test_seek.

Fix this by ensuring that test_seek has a dependency on libbabeltrace
and libbabeltrace-ctf. This is a temporary work-around until we improve
our plugin handling.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/lib/Makefile.am
tests/lib/test_seek.c

index 763b7bc0b9619c25acccc9d9efa39cc285206c56..849767a77e8a4ae96e6e5899a0191aa888a676c5 100644 (file)
@@ -6,6 +6,10 @@ LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
 
 libtestcommon_a_SOURCES = common.c common.h
 
+# -Wl,--no-as-needed is needed for recent gold linker who seems to think
+# it knows better and considers libraries with constructors having
+# side-effects as dead code.
+test_seek_LDFLAGS = -Wl,--no-as-needed
 test_seek_LDADD = $(LIBTAP) libtestcommon.a \
        $(top_builddir)/lib/libbabeltrace.la \
        $(top_builddir)/formats/ctf/libbabeltrace-ctf.la
index b33f80dc2e08455987ecc01b244916371712e417..170c830dd6ec30aeced250e2295e9a7b8d279b6a 100644 (file)
@@ -23,6 +23,7 @@
 #include <babeltrace/iterator.h>
 #include <babeltrace/ctf/iterator.h>
 #include <babeltrace/ctf/events.h>
+#include <babeltrace/babeltrace-internal.h>    /* For symbol side-effects */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -273,6 +274,13 @@ int main(int argc, char **argv)
        uint64_t expected_begin;
        uint64_t expected_last;
 
+       /*
+        * Side-effects ensuring libs are not optimized away by static
+        * linking.
+        */
+       babeltrace_debug = 0;   /* libbabeltrace.la */
+       opt_clock_offset = 0;   /* libbabeltrace-ctf.la */
+
        plan_tests(NR_TESTS);
 
        if (argc < 4) {
This page took 0.024959 seconds and 4 git commands to generate.