Getting expat compiled properly

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Sep 4 06:43:09 EDT 2001


"Magnus Lie Hetland" <mlh at idi.ntnu.no> writes:

> I have managed to compile expat so it works with
> Python (2.2a1), but when I try to run cgi scripts now,
> they don't work. The reason is that Python can't
> find libexpat.so ... 

You didn't mention what operating system you are using; most likely,
setting LD_LIBRARY_PATH would work around this problem? On Linux,
adding the path containing libexpat.so into /etc/ld.so.conf would also
help.

> I thought this was supposed to be a static link (with libexpat.a)?

What made you think so? In the presence of both a static and a dynamic
library, all linkers I know will prefer the dynamic one (unless you
tell them otherwise).

> How am I supposed to do this to make it work properly?

There are many options. I'd recommend to build libexpat as a static
library only; if you want pyexpat as a dynamic extension module, make
sure to build it as PIC code, though.

> I've edited the lines in Modules/Setup -- I can't find any other,
> more "Distutils-like" way of doing it... Is there something else I'm
> missing?

If you want to pass a -R option to the linker, that's the proper
way. It also is the proper way if you want to statically build pyexpat
into the interpreter.

> What's going on here? With all the XML support in
> Python 2.2, installing expat (which is a requisite)
> really ought to be simple, no? 

Why do you think it ought to be simple? expat is a project completely
independent from Python - there is only a slight overlap in the
contributors to both projects. So "we" (as Python contributors) can do
nothing but give instructions on how to build libexpat; using those
instructions, you would have ended up with only a libexpat.a, and no
libexpat.so.

Regards,
Martin



More information about the Python-list mailing list