[xml] libxml and Python segfaults



Hello all.

Everything installs fine, but when I actually enter Python and try to applyStylesheet() to a document, it segfaults somewhere inside of the applyStylesheetInternal() function in the XSLT library. I am currently running Ubuntu 8.10 and Python 2.5.2.

I have a different version of libxml2 that I don't want it to use installed on my system. As a result, my build process is somewhat convoluted. Here is what I did:

1. Untarred the source for libxml2 version 2.7.3 and libxslt version 1.1.24.

2. Set my CFLAGS. The macro undefinition is for an Ubuntu-specific build flag which does a whole bunch of extra checks for system call sematics. If I don't turn it off, the library refuses to build:
export CFLAGS="-O2 -pipe -U_FORTIFY_SOURCE"

3. Built libxml2. I have also tried this with shared libraries, but with an identical result, so I tried static:

cd libxml2-2.7.3
mkdir install
./configure --enable-static --disable-shared --prefix=$PWD/install
make -j2 all
make install

4. Built libxslt in the same place, which also succeeds:
cd ../libxslt-1.1.24
./configure --enable-shared --disable-static --with-libxml-prefix=$PWD/../libxml2-2.7.3/install --prefix=$PWD/../libxml2-2.7.3/install
make -j2 all
make install

So what I now have is one shared library, containing both libxml2 and libxslt. Python imports it fine:

>>> import sys
>>> sys.path.insert(0, './libxml2-2.7.3/install/lib/python2.5/site-packages')
>>> import libxslt
>>>

However, as mentioned, when I actually try to create a stylesheet object, a libxml2 document, and then applyStylesheet(doc, None), it segfaults. The actual construction of the document is too long to reconstruct at the moment.

I can think of several things which could be wrong here:

1. I've got a mismatching version of libxslt and libxml2. This seems to have been the reason for many segfaults in the history of this mailing list. 2. Other Ubuntu compiler flags are still getting in the way, even though I thought I turned them off. 3. It's still loading or linking against the version on my system. I consider this unlikely, because configure displayed the right version, and I know my libraries are older than this. 4. Python is messed up somehow with its own xml libraries. I use xml.dom.minidom to construct the document, and do toxml() to create the input to the stylesheet. It looks like valid XML, and the libxml2 document object created by parseMemory() seems valid, so this is also unlikely.

Hopefully someone can help me, despite my odd situation.
--
Dan Harrison
"Software doesn't have bugs; sometimes, it just generates random features."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]