[PATCH 2/3] build: fix DSO dependencies

Felipe Contreras felipe.contreras at gmail.com
Sat Jun 5 04:05:14 PDT 2010


At least on Fedora 13, this doesn't link; the linker finds the
dependencies, and aborts saying we should include them.

/usr/bin/ld: gmime-filter-reply.o: undefined reference to symbol 'g_mime_filter_set_size'
/usr/bin/ld: note: 'g_mime_filter_set_size' is defined in DSO /usr/lib/libgmime-2.6.so.0 so try adding it to the linker command line
/usr/lib/libgmime-2.6.so.0: could not read symbols: Invalid operation

We do need to link at least to what we really use, the linker resolves
the dependencies of our dependencies at loading time. So let's only
specify what we use directly.

For more information, see:
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange

Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---

NOTE: I'm not sure about using $(CC) as a linker in !linux platforms, but if
that doesn't work, there's already an 'ifeq' that checks for that so it can be
moved there.

 Makefile.local |    3 ---
 configure      |   11 +++++------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index bc61a3c..cc8b23b 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -33,10 +33,7 @@ FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
 FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Llib -lnotmuch
 FINAL_NOTMUCH_LINKER = CC
-ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
 FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS)
-FINAL_NOTMUCH_LINKER = CXX
-endif
 ifeq ($(PLATFORM),LINUX)
 ifeq ($(LIBDIR_IN_LDCONFIG),0)
 FINAL_NOTMUCH_LDFLAGS += -Wl,--enable-new-dtags -Wl,-rpath,$(libdir)
diff --git a/configure b/configure
index 1eb4785..ff775f0 100755
--- a/configure
+++ b/configure
@@ -255,7 +255,11 @@ for gmimepc in gmime-2.6 gmime-2.4; do
 	printf "Yes ($gmimepc).\n"
 	have_gmime=1
 	gmime_cflags=$(pkg-config --cflags $gmimepc)
-	gmime_ldflags=$(pkg-config --libs $gmimepc)
+	if [ $linker_resolves_library_dependencies = "1" ]; then
+		gmime_ldflags="-lgmime-2.6 -lgobject-2.0 -lglib-2.0"
+	else
+		gmime_ldflags=$(pkg-config --libs $gmimepc)
+	fi
     fi
 done
 if [ "$have_gmime" = "0" ]; then
@@ -481,11 +485,6 @@ HAVE_STRCASESTR = ${have_strcasestr}
 # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS
 PLATFORM = ${platform}
 
-# Whether the linker will automatically resolve the dependency of one
-# library on another (if not, then linking a binary requires linking
-# directly against both)
-LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
-
 # Flags needed to compile and link against Xapian
 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
 XAPIAN_LDFLAGS = ${xapian_ldflags}
-- 
1.7.0.1



More information about the notmuch mailing list