problems with symbol hiding on Debian Squeeze i386

Subject: problems with symbol hiding on Debian Squeeze i386

Date: Mon, 11 Jul 2011 16:25:18 -0300

To: notmuch

Cc:

From: David Bremner


Julien Valroth reported on IRC that he had problems with the initial
call of 'notmuch new' crashing with

terminate called after throwing an instance of 'Xapian::InvalidArgumentError'

I confirmed that the following quick and dirty patch seems to fix the problem.

--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -36,7 +36,7 @@ LIBRARY_SUFFIX = so
 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
-LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME)
+LIBRARY_LINK_FLAG = -shared -Wl,-soname=$(SONAME)
 ifeq ($(LIBDIR_IN_LDCONFIG),1)
 ifeq ($(DESTDIR),)
 LIBRARY_INSTALL_POST_COMMAND=ldconfig

I haven't quite decided what to do about this yet, but I thought I'd get
this on the record, because it seems to me a few people have been having
problems with this.

FWIW, I tested with various versions of xapian and libgmime, but the
problem still exists for  gmime 2.4.25-1, and xapian 1.2.5-1, both
recompiled for squeeze.

If you install the libxapian22 from sid, then gcc and libc6 are both
upgraded, and the problem goes away (but you are not really running
squeeze anymore).  

About the only good news is that the symbol hiding test does indeed fail
on squeeze i386.

I have appended part of the backtrace, in case anyone finds it
illuminating.  As far as I can tell without line numbers, the catch in
_notmuch_message_remove_term is failing. I suppose this could be the
kind of "exceptions start mysteriously malfunctioning" that
http://gcc.gnu.org/wiki/Visibility warns about.

Xapian _seems_ to do the right thing with visisibility
declarations for these exception classes.

I don't know what, if anything to conclude from the fact that everything
seems to work fine in gcc 4.6.

backtrace:

#4  0xf7ac2442 in std::terminate() () from /usr/lib/libstdc++.so.6
#5  0xf7ac2581 in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0xf7b3fb83 in Xapian::Document::Internal::remove_term(std::string const&) ()
   from /usr/lib/sse2/libxapian.so.22
#7  0xf7b3fc76 in Xapian::Document::remove_term(std::string const&) ()
   from /usr/lib/sse2/libxapian.so.22
#8  0xf7fd5233 in _notmuch_message_remove_term ()
   from /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.1
#9  0xf7fd5389 in notmuch_message_remove_tag ()
   from /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.1
#10 0xf7fd63ea in notmuch_message_maildir_flags_to_tags ()
   from /home/bremner/software/upstream/notmuch/lib/libnotmuch.so.1
#11 0x08050483 in add_files_recursive ()
part-000.sig (application/pgp-signature)

Thread: