[xml-bindings] Problems building private Python bindings for a private libxml & libxslt



Hello,

At work I've been attempting to build private python bindings (i.e. installed somewhere other than /usr/lib/python/site-packages) for a private build of both libxml2 and libxslt. I'm working on a Debian box, and we have an earlier /usr/lib installed libxml2 which we can't easily upgrade because of application dependence, and now need a private build to get a project working. While building libxml2 and libxslt in /home/matt/ is a fairly simple matter, getting the python bindings built and linking to the right libxml2.so is much harder.

Our tactic was to run <setup.py build> to generate the bindings, which we could then copy by hand to where we needed them. I had no luck initially, but after some patching got that to work

We've had no joy at all with libxslt, and I've no real idea where to start.

Getting the libxml2 install to work took a couple of changes:

The first was to change the order in which setup.py looks for the libxml2 includes, since the libxml2mod.so setup.py build was creating was linked, according to ldd, to the system libxml2:

The original, at line 56 of setup.py

includes_dir = [
"/usr/include",
"/usr/local/include",
"/opt/include",
os.path.join(ROOT,'include'),
HOME
];

Became

includes_dir = [
os.path.join(ROOT,'include'),
"/usr/include",
"/usr/local/include",
"/opt/include",
HOME
];

The second change was to add

runtime_library_dirs=libdirs

to the extens list at line 195 of setup.py:

extens=[Extension('libxml2mod', c_files, include_dirs=includes,
				library_dirs=libdirs,
				runtime_library_dirs=libdirs,
				libraries=libs, define_macros=macros)]

That got us a libxml2 python binding which ldd claimed was linked against the correct libxml2.so.

As for libxslt, I understand that the setup.py from libxml2 can build both sets of bindings, but we tried copying the libxslt files across and had no luck. I'm sure I was just being dense here, but some pointers would be very much appreciated!

If anyone can offer help or point me to resources detailing the process I'd be very grateful.

Thanks,

Matt

--
  Matt Patterson | Design & Code
  <matt emdash co uk> | http://www.emdash.co.uk/
  <matt reprocessed org> | http://www.reprocessed.org/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]