Compiling some packages (e.g. votca-csg in sci-overlay) statically with libxml2 lead to a strange segmentation fault due to a weak symbol linking of pthreads. However we at votca.org have not figured out how to solve this issue yet, that is the reason why we would like to have a threads use flags for libxml2, because the problem is in the thread code somewhere. Adding a "$(use_with threads)" to the configure part is actually enough.
For the moment, tweaking pkgconfig file (Libs.private) seems a better idea - at least, if it would work.
The patch (see url), which I submitted to the libxml bug tracker does essentially that. The problem is, weaking .la files, xml2-config and pkgconfig alone doesn't help. However I still think the threads use flag is missing.
Created attachment 221583 [details] test program This is a small test case to see the bug. It builds: -a lib, libinit, which just calls xmlInitParser -two binaries ,a dynamic and a static one The static one will fail, when threads are enabled.
Created attachment 221599 [details] test program Better version of the test program
Comment on attachment 221599 [details] test program Unneeded, simpler case below.
Here is the simplest case I can imagine: $ cat main.c #include <libxml/parser.h> int main(int argc, char **argv) { xmlInitParser(); } $ gcc -static main.c `xml2-config --libs --cflags` -pthread $ ./a.out Segmentation fault
Actually all packages having static useflag should depend on libxml2[-threads] or at least have a check in configure. As far as I can see only sci-chemistry/gromacs[xml] sci-chemistry/votca-csg (sci-overlay) are affected! Feel free to join the discussing on the libxml2 bugtracker (see url).
Created attachment 222469 [details] m4 check for broken libxml2 We are using this check in the votca package...
The configure option --with-threads enables the main thread support for libxml2! So it is NOT THREADSAFE without this option. Please add it to the maintree.
Link to upstream documentation: http://xmlsoft.org/threads.html
actually it is a problem with the weak symbol definitions, see url in the header of the bug
This bug is tracked under debian bug #590934: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=590934 and there is a patch to solve the issue by moving xmlInitThreads() The patch works for me!
The debian patch doesn't look too bad. One needs to checks that nothing in xmlInitGlobals is needed by xmlInitThreads but other than that, it seems fine to add to portage.
I think this is not the case: http://git.gnome.org/browse/libxml2/tree/threads.c#n860
the patch has been accepted upstream, so I think it is safe to add it.
Created attachment 250895 [details, diff] patch to a potential segfault due to weak symbols on pthreads
Created attachment 250897 [details, diff] patch for libxml2-2.7.7.ebuild It also includes support for threads use flag.
+*libxml2-2.7.8 (11 Feb 2011) + + 11 Feb 2011; Pacho Ramos <pacho@gentoo.org> -libxml2-2.7.6.ebuild, + +libxml2-2.7.8.ebuild, +files/libxml2-2.7.8-reactivate-script.patch, + +files/libxml2-2.7.8-xpath-freeing.patch, + +files/libxml2-2.7.8-xpath-freeing2.patch, + +files/libxml2-2.7.8-xpath-memory.patch: + Version bump including security fixes, bump to eapi3, remove old. +