Hello,<br><br>I am trying to get the Windows lxml egg to work with Cygwin, Python 2.5.2 on WindowsXP, 32bit. I wasn't able to find a Cygwin package for lxml so I felt I needed to obtain or build a win32 version of lxml. I want to use the xpath functionality that lxml provides in python scripts, running in Cygwin.<br>
<br>*** All commands below are issued in a Cygwin bash shell ***<br><br>I downloaded <span style="white-space: nowrap;"></span><a href="http://pypi.python.org/packages/2.5/l/lxml/lxml-2.2.1-py2.5-win32.egg#md5=e7848267af1916a689927bdd1432abb4">lxml-2.2.1-py2.5-win32.egg</a> from <a href="http://pypi.python.org/pypi/lxml/2.2.1">http://pypi.python.org/pypi/lxml/2.2.1</a> and placed it in a directory, setting PYTHONPATH to point here too. However pkg_resources.require() can't find it, so instead I unzipped it into a directory called 'lxml'. Then I do this:<br>
<br>$ python<br>Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)<br>[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin<br>Type "help", "copyright", "credits" or "license" for more information.<br>
>>> from lxml import etree<br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br> File "lxml/etree.py", line 7, in <module><br> __bootstrap__()<br>
File "lxml/etree.py", line 6, in __bootstrap__<br> imp.load_dynamic(__name__,__file__)<br>ImportError: Permission denied<br><br><br>Ok, I think I know why this is happening, so I do this:<br>$ chmod +x lxml/*.pyd<br>
$ python<br>Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)<br>[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin<br>Type "help", "copyright", "credits" or "license" for more information.<br>
>>> from lxml import etree<br>Segmentation fault (core dumped)<br><br>Ok, so that didn't work.<br><br>The next thing I tried was the instructions found here: <a href="http://www.scribd.com/doc/16158375/LXML-221-documentation">http://www.scribd.com/doc/16158375/LXML-221-documentation</a> in section 23.7 - "Static linking on Windows".<br>
I downloaded the latest versions of iconv, libxml2, libxslt, zlib and lxml-2.2.1.tar.gz. I unpacked them as per the instructions and edited lxml-2.2.1/setup.py to fix the STATIC_INCLUDE_DIRS and STATIC_LIBRARY_DIRS to point back to those newly extracted libraries. Now I run:<br>
<br>$ cd lxml-2.2.1<br>$ python setup.py bdist_wininst --static<br>Building lxml version 2.2.1.<br>NOTE: Trying to build without Cython, pre-generated 'src/lxml/lxml.etree.c' needs to be available.<br>ERROR: /bin/sh: xslt-config: command not found<br>
<br>** make sure the development packages of libxml2 and libxslt are installed **<br><br>Using build configuration of libxslt<br>Building against libxml2/libxslt in one of the following directories:<br> ..\libxml2-2.7.3.win32\lib<br>
..\libxslt-1.1.24.win32\lib<br> ..\zlib-1.2.3.win32\lib<br> ..\iconv-1.9.2.win32\lib<br>running bdist_wininst<br>error: distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform<br>
<br>So I figure this is because I'm trying to build inside Cygwin. I tried inside a cmd.exe window, and it gets a bit further but then complains about not having VisualC++2003 installed... I tried -c mingw32 but setup.py didn't understand that option. Seemed like a dead end. I think it might be picking up my ActiveState Python installation too, rather than the Cygwin one.<br>
<br>I also tried the actual versions of libxml, libxslt etc that the document actually mentions, same result.<br><br>Anyway, my understanding is that all this should be unnecessary - the .egg should contain everything I need, shouldn't it? But the segmentation fault at import time is bad.<br>
<br>I'd really like to use lxml in Cygwin if possible, because all the other options for xpath processing seem very limited. I like the idea of the egg because I want to be able to deploy my XML-processing python scripts with the .egg, so that I don't need to install any additional software (such as Cygwin packages).<br>
<br>Any help would be greatly appreciated, please.<br><br>Regards,<br><br>-- David.<br><br><br><br><br><br><br><br>