Make dlopen more robust by using the .0 target for the library
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Dec 2011 16:10:31 +0000 (11:10 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Dec 2011 16:10:31 +0000 (11:10 -0500)
We've experienced a double library load on a setup where the lttng-ust
.so and .so.0 were two physical files instead of a symlink (as they
should be). So let's make liblttng-ust slightly more robust by
specifying the target .so.0 instead of .so. It will also make handling
of library version upgrades easier.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
include/lttng/tracepoint.h
liblttng-ust/Makefile.am
libringbuffer/Makefile.am

index 927bae362c83de329c35c1a2904dcba483d138a0..459bccbe0f5e823fd6362620f54f97dea9e94b0e 100644 (file)
@@ -2,6 +2,13 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_INIT([lttng-ust],[1.9.1],[mathieu dot desnoyers at efficios dot com])
+
+# Following the numbering scheme proposed by libtool for the library version
+# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+AC_SUBST([LTTNG_UST_LIBRARY_VERSION], [0:0:0])
+# note: remember to update tracepoint.h dlopen() to match this version
+# number. TODO: eventually automate by exporting the major number.
+
 AC_CONFIG_AUX_DIR([config])
 AC_CANONICAL_TARGET
 AC_CANONICAL_HOST
index 2942c175e7cf0580ecf39edd99b78a1eb47d9c9c..1adb149db3994a5dcd40840126bfdef22868cb2b 100644 (file)
@@ -190,7 +190,7 @@ static void __attribute__((constructor)) __tracepoints__init(void)
        if (__tracepoint_registered++)
                return;
 
-       liblttngust_handle = dlopen("liblttng-ust.so", RTLD_NOW | RTLD_GLOBAL);
+       liblttngust_handle = dlopen("liblttng-ust.so.0", RTLD_NOW | RTLD_GLOBAL);
        if (!liblttngust_handle)
                return;
        tracepoint_register_lib =
index 6b33906be4ecd44f105aec965fc0f777cea16d37..a71f2074116b40ef01c412e0f27a5bf8f67f04c8 100644 (file)
@@ -37,7 +37,7 @@ liblttng_ust_support_la_SOURCES = \
 
 liblttng_ust_la_SOURCES =
 
-liblttng_ust_la_LDFLAGS = -no-undefined -version-info 0:0:0
+liblttng_ust_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION)
 
 liblttng_ust_support_la_LIBADD = \
        $(top_builddir)/libringbuffer/libringbuffer.la
index f1d7ade37aa9efd95a379851d3246cc4858c1426..9bd8586812a19b46a42ee9ed6abf2055053c563d 100644 (file)
@@ -13,9 +13,6 @@ libringbuffer_la_SOURCES = \
        frontend_api.h frontend.h frontend_internal.h frontend_types.h \
        nohz.h vatomic.h
        
-
-libringbuffer_la_LDFLAGS = -no-undefined -version-info 0:0:0
-
 libringbuffer_la_LIBADD = \
        -lpthread \
        -lrt
This page took 0.027195 seconds and 4 git commands to generate.