23 Jun 11:37
Re: Using, or building, lxml in Windows with Cygwin
David Antliff <david.antliff <at> gmail.com>
2009-06-23 09:37:32 GMT
2009-06-23 09:37:32 GMT
On Wed, Jun 17, 2009 at 18:35, Stefan Behnel<stefan_ml <at> behnel.de> wrote: > David Antliff wrote: >> I am trying a slightly different approach - compiling entirely within >> Cygwin, using Cygwin's gcc. > > Right, that should be best anyway. > > >> 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. > > ... which you may be able to fix using appropriate CFLAGS/LDFLAGS. [snip] > I don't know if you install the libiconv developer package on your machine > (I hope that exists in Cygwin), because building against the shared lib > should work just fine here. Maybe you need to point gcc to the right > include and/or lib directory. I wonder why it didn't add "-liconv" > automatically... > > You can also try to go the ugly route and add "/usr/lib/libiconv.a" to your > CFLAGS, but I think you'll be happier with the shared lib. > > >> I wonder why setup.py didn't automatically download libiconv when it >> downloaded libxml2 and libxslt... hmm > > Because the static build was designed for MacOS-X, where only those two > libraries are a problem. The libiconv is binary compatible enough across > versions not to pose any major problems. So it's best to build dynamically > against libiconv. > > That said, it shouldn't be too hard to add code to also download libiconv > and build it. I would be happy to receive a patch that accepts an optional > list of library names for the --static-deps option, as in > "--static-deps=libxml2,libxslt,iconv", and would then download and build > all requested libraries. Although I doubt that it would make sense (or even > work) to pass only "--static-deps=iconv", so maybe a new option > "--build-iconv" would be better. Hi Stefan, I must admit I don't understand how setup.py, setupinfo.py and distutils all fits together. By watching the output of 'python setup.py build --static-deps' it's fairly clear to me what is needed to fix each step, but I can't work out where one sets extra CFLAGS or LDFLAGS in setup.py so that I can continue the process beyond each error. What would also help is if I knew what command I was meant to be using. The documentation suggests all sorts of options and I'm really not sure what I'm doing. Here's what I want to end up with: - a statically compiled python 'egg' of lxml that I can simply distribute with a python script and use in Cygwin. Here's what I currently have: - lxml-2.2.1 tar.gz unpacked - Cygwin *without* libxml2 or libxslt installed (I don't want my users to have to install these via Cygwin setup.exe). - gcc, ld, etc are all present As per a previous email, I tried: $ python setup.py build --static-deps But this has problems finding libiconv. You suggested I could use-liconv to fix this, but I can't work out where to actually put this in setup.py or setupinfo.py. $ ls /usr/lib/libic* /usr/lib/libiconv.a /usr/lib/libiconv.dll.a /usr/lib/libiconv.la However that's on my own machine - it turns out that nobody else has Cygwin's libiconv installed, so I'd like to *statically* link in libiconv too. Dynamically linking won't work in my case. I think the biggest problem I have is that having to run "python setup.py build" every time clears out everything. It would be good if I could get setup.py to simply print all the command lines it intends to use without actually running them... Any assistance you can give me would be greatly appreciated please. Regards, -- David.
RSS Feed