[lxml-dev] problems with custom build
Stefan Behnel
stefan_ml at behnel.de
Fri Apr 3 08:09:05 CEST 2009
Hi,
Victor Borda wrote:
> I was very excited today to find the lxml module for python. As I need to
> write some xml checking scripts and finding bash scripting not well suited,
> I have decided to give python a try. So far I like it. However, here is the
> situation:
>
> 1) The target platform has an older RedHat installation with glibc2.3.4, so
> none of the binaries for libxml or libxslt were of any use. So I had to
> build from source on those. Not too painful.
> 2) However, trying to get lxml running has been really difficult. I need
> help here.
> 3) The target machine is not connected to the internet. It is not able to
> remotely retrieve packages.
>
> Questions/Steps:
> 0) There don't appear to be any rpm's for lxml. Is this correct?
> 1) Since I don't have an internet connection from this machine it means I
> have to build from source, don't I (ie easy_install is not an option)?
> 2) I have assumed that I do have to build from source so I have given it a
> shot. I copied over the lxml2.2 tar file, unzipped it.
> 3) I got setuptools-0.6c9-py2.3.egg and dropped in that unzipped directly,
> and ran python ez_setup.py which seemed to go fine.
> 4) Then I ran python setup.py build. The build seemed to go fine.
> 5) I go to run test.py and I get this error message:
>
> []# python test.py
> Traceback (most recent call last):
> File "test.py", line 595, in ?
> exitcode = main(sys.argv)
> File "test.py", line 558, in main
> test_cases = get_test_cases(test_files, cfg, tracer=tracer)
> File "test.py", line 260, in get_test_cases
> module = import_module(file, cfg, tracer=tracer)
> File "test.py", line 203, in import_module
> mod = __import__(modname)
> File "/home/victorborda/buildstuff/lxml-2.2/src/lxml/html/__init__.py",
> line 12, in ?
> from lxml import etree
> ImportError: /home/victorborda/buildstuff/lxml-2.2/src/lxml/etree.so:
> undefined symbol: xmlSchematronFree
I assume that you have installed newer versions of libxml2 and libxslt
somewhere, but it looks like lxml can't find them at runtime. Try to
compile with lxml with the "--auto-rpath" option to make it remember where
it found the libraries it was built against.
Another option is to copy the libxml2 and libxslt tar.gz archives into
"lxml-2.2/libs/" and pass
--static-deps --libxml2-version=2.X.Y --libxslt-version=1.1.XY
to setup.py, which will then build those libs first and build lxml
statically against them.
Stefan
More information about the lxml-dev
mailing list