Mittwoch, 12. August 2009

libxml2 crash on 64bit Ubuntu

I've spent the last couple of hours debugging a really strange segfault. Our application stack had a reproduceable crash in libxml2 -- but only with self compiled versions of libxml2. Ubuntu's 2.6.32 worked like a charm, my self compiled 2.6.32 didn't. The very same version works on several other Debian, Redhat and SuSE boxes, 32 and 64bit, too. WTF!?

The crash always occured in xmlIO.c:__xmlParserInputBufferCreateFilename() with xmlGzfileOpen() as open handler. After several gdb debugging sessions and several recompiles I noticed a suspicious message in the make output:

xmlIO.c: In function 'xmlGzfileOpen_real':
xmlIO.c:1132: warning: implicit declaration of function 'gzopen64'
xmlIO.c:1132: warning: nested extern declaration of 'gzopen64'
xmlIO.c:1132: warning: assignment makes pointer from integer without a cast
xmlIO.c: In function 'xmlGzfileOpenW':
xmlIO.c:1200: warning: assignment makes pointer from integer without a cast

The message only occured during my own compiles but not during "apt-get source -b libxml2" . Apparently Ubuntu has patched the sources to fix the issue. The changelog contains yet another hint:

* libxml.h: define _LARGEFILE64_SOURCE to properly get gzopen64 defines in zlib.h. Closes: #439843. Thanks Dann Frazier.

That's the solution to my problem! CFLAGS="-D_LARGEFILE64_SOURCE" ./configure and both the compiler warning and the crash is gone.

Keine Kommentare:

Kommentar veröffentlichen