[lxml-dev] Using, or building, lxml in Windows with Cygwin
David Antliff
david.antliff at gmail.com
Wed Jun 17 02:06:59 CEST 2009
> On Tue, Jun 16, 2009 at 18:46, Stefan Behnel <stefan_ml at behnel.de> wrote:
>> I never tried building lxml on Windows myself, but with Cygwin, you may
>> get away with installing the developer packages of libxml2 and libxslt, or
>> with simply passing "--static-deps" as described for the MacOS build.
>> MinGW should work, but you need to configure it in your distutils.cfg:
>>
>> [build]
>> compiler=mingw32
>>
>> http://docs.python.org/install/index.html#location-and-names-of-config-files
>>
>> If you get it to work, please report anything you had to do to the list.
>> Or even better: write a little section for this file:
>>
>> http://codespeak.net/svn/lxml/trunk/doc/build.txt
>>
>> Please ask back if you run into further problems.
I am trying a slightly different approach - compiling entirely within
Cygwin, using Cygwin's gcc.
What I have done is unpacked lxml-2.2.1.tgz.gz into lxml-2.2.1, then
inside that directory I try:
$ python setup.py build --static-deps
This proceeds to download libxml2 and libxslt, unpack them, and build
them. But it runs into numerous problems related to include/library
paths. Here are my 'fixes' as they pop up. I run the correct command
manually, then type 'make' to continue the process. Unfortunately if I
run that setup.py command again, it clears out the progress-so-far, so
I'm not sure what I'm going to do once Make completes successfully...
running build
running build_py
running build_ext
building 'lxml.objectify' extension
gcc -shared -Wl,--enable-auto-image-base
build/temp.cygwin-1.5.25-i686-2.5/src/lxml/lxml.objectify.o
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libexslt.a
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libxml2.a
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libxslt.a
-L/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib
-L/usr/lib/python2.5/config -lz -lm -lpython2.5 -o
build/lib.cygwin-1.5.25-i686-2.5/lxml/objectify.dll
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libxml2.a(encoding.o):
In function `xmlFindCharEncodingHandler':
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2-2.7.3/encoding.c:1614:
undefined reference to `_libiconv_open'
...more libiconv errors...
I fix this by adding "/usr/lib/libiconv.a":
$ gcc -shared -Wl,--enable-auto-image-base
build/temp.cygwin-1.5.25-i686-2.5/src/lxml/lxml.objectify.o
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libexslt.a
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libxml2.a
/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib/libxslt.a
-L/cygdrive/d/git/work/lxml-exp/lxml-2.2.1/build/tmp/libxml2/lib
-L/usr/lib/python2.5/config -lz -lm -lpython2.5 -o
build/lib.cygwin-1.5.25-i686-2.5/lxml/objectify.dll
/usr/lib/libiconv.a
I wonder why setup.py didn't automatically download libiconv when it
downloaded libxml2 and libxslt... hmm
Now I type 'make' to continue to the next problem:
Using build configuration of libxslt
running build_ext
building 'lxml.etree' extension
gcc -shared -Wl,--enable-auto-image-base
build/temp.cygwin-1.5.25-i686-2.5/src/lxml/lxml.etree.o
-L/usr/lib/python2.5/config -lxslt -lexslt -lxml2 -lz -lm -lpython2.5
-o build/lib.cygwin-1.5.25-i686-2.5/lxml/etree.dll
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
cannot find -lxslt
collect2: ld returned 1 exit status
But at this point I'm not convinced 'make' is doing the same thing
that the --static-deps would cause. So I'm not sure this is a valid
path to take.
Is there a way to have 'setup.py build' continue from where it last
reached, rather than starting everything again from scratch?
-- David.
More information about the lxml-dev
mailing list