From e5f3a85af1cb0be51a54be6ae158ec9108c6fda0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 18 Jul 2011 11:43:31 +0100 Subject: [PATCH] Link a second static library for libtp-glib-tests, against libtelepathy-glib-internal.la Linking with -Bsymbolic (as done by default on recent Ubuntu) ends up linking different parts of the executable against the copy of libtelepathy-glib-internal in the shared library, and the copy in the static library. This leads to mysterious GLib assertion failures. Tests that need to access internal symbols (and thus link against libtelepathy-glib-internal.la) must now use libtp-glib-tests-internal.la instead of libtp-glib-tests.la. There's currently no difference between the two except their dependencies, but in principle, we could add test glue that also requires internal symbols to libtp-glib-tests-internal while avoiding including it in libtp-glib-tests. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39183 --- tests/Makefile.am | 4 ++-- tests/dbus/Makefile.am | 4 ++-- tests/lib/Makefile.am | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9f6caff..88e4fc8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -59,7 +59,7 @@ test_asv_SOURCES = \ test_capabilities_SOURCES = \ capabilities.c test_capabilities_LDADD = \ - $(top_builddir)/tests/lib/libtp-glib-tests.la \ + $(top_builddir)/tests/lib/libtp-glib-tests-internal.la \ $(top_builddir)/telepathy-glib/libtelepathy-glib-internal.la \ $(GLIB_LIBS) @@ -67,7 +67,7 @@ test_capabilities_LDADD = \ test_contact_search_result_SOURCES = \ contact-search-result.c test_contact_search_result_LDADD = \ - $(top_builddir)/tests/lib/libtp-glib-tests.la \ + $(top_builddir)/tests/lib/libtp-glib-tests-internal.la \ $(top_builddir)/telepathy-glib/libtelepathy-glib-internal.la \ $(GLIB_LIBS) diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am index 0dee950..5cf060a 100644 --- a/tests/dbus/Makefile.am +++ b/tests/dbus/Makefile.am @@ -71,7 +71,7 @@ test_account_SOURCES = account.c # this one uses internal ABI test_account_channel_request_SOURCES = account-channel-request.c test_account_channel_request_LDADD = \ - $(top_builddir)/tests/lib/libtp-glib-tests.la \ + $(top_builddir)/tests/lib/libtp-glib-tests-internal.la \ $(top_builddir)/telepathy-glib/libtelepathy-glib-internal.la \ $(GLIB_LIBS) @@ -210,7 +210,7 @@ test_proxy_preparation_SOURCES = proxy-preparation.c test_cm_message_SOURCES = \ cm-message.c test_cm_message_LDADD = \ - $(top_builddir)/tests/lib/libtp-glib-tests.la \ + $(top_builddir)/tests/lib/libtp-glib-tests-internal.la \ $(top_builddir)/telepathy-glib/libtelepathy-glib-internal.la \ $(GLIB_LIBS) diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index b52e685..2adf664 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -1,4 +1,17 @@ -noinst_LTLIBRARIES = libtp-glib-tests.la +# It's necessary to distinguish between modules that link to +# libtelepathy-glib.la (normally a shared library, containing a copy of +# libtelepathy-glib-internal.la) and libtelepathy-glib-internal.la (a static +# convenience library). Under -Bsymbolic, you can't safely link both. +# +# You can either link to libtp-glib-tests.la and libtelepathy-glib.la, +# or to libtp-glib-tests-internal.la and libtelepathy-glib-internal.la. +# Do not mix the versions. +# +# See https://bugs.freedesktop.org/show_bug.cgi?id=39183 +noinst_LTLIBRARIES = \ + libtp-glib-tests.la \ + libtp-glib-tests-internal.la \ + $(NULL) libtp_glib_tests_la_SOURCES = \ bug-19101-conn.c \ @@ -51,6 +64,7 @@ libtp_glib_tests_la_SOURCES = \ textchan-group.h \ util.c \ util.h +libtp_glib_tests_internal_la_SOURCES = $(libtp_glib_tests_la_SOURCES) check_c_sources = *.c include $(top_srcdir)/tools/check-coding-style.mk @@ -65,6 +79,11 @@ AM_LDFLAGS = \ $(ERROR_LDFLAGS) \ $(NULL) +libtp_glib_tests_internal_la_LIBADD = \ + $(DBUS_LIBS) \ + $(GLIB_LIBS) \ + $(top_builddir)/telepathy-glib/libtelepathy-glib-internal.la + libtp_glib_tests_la_LIBADD = \ $(DBUS_LIBS) \ $(GLIB_LIBS) \ -- 1.7.5.4