[Image-SIG] Building for Python 1.5.2
pete at jwgibbs.CChem.Berkeley.EDU
Sun Sep 4 23:41:25 CEST 2005
[I gather this is the place to send comments, even though I'm not on
the mailing list]
Folks, I feel I suffered unnecessary pain (:-/) in getting PIL working with
1.5.2 [which the README said it was supposed to work with).
(I'm using 1.5.2 rather than a newer edition for a couple of reasons:
a) It's the one currently on my Linux machine -- where I've been installing
PIL -- and I'm happy to stick with it as it meets my needs; b) my main
platform is still BeOS (!) which never got Python updated beyond that
version, and I'd rather keep parity across my systems. Haven't even
tried to add PIL there yet...)
Anyway, I hit several blocks on the way to get PIL working (which it
now is). Best to mention my solution first, I think.
In _imaging.c I had to add:
#define PyObject_New PyObject_NEW
#define PyMem_Del PyMem_DEL
because the Python header files (actually 'objimpl.h') define the
latter symbols, but the code uses the first!
The first mismatch showed up obscurely as a syntax error in compiling
(and it took a while to find the reason...), but the second didn't
show up until selftest.py, where I got the (apparently not uncommon!)
rather unhelpful message "_imaging C Module not installed". I eventually
found this by patching out the try/except statements in selftest.py
and Image.py, so that I got an actual traceback (which told me 'PyMem_Del'
The "...not installed" message was puzzling, because I could *see*
"_imaging.so" sitting there! Might I suggest that something like
"Could not import the _imaging C module" might be more appropriate?
Even better to pass the traceback on, so that problems such as I
hit become visible.
I encountered another slight apparent problem with setup.py. It
seems that it looks for libjpeg, but doesn't test for the presence
of the header files, even though it needs them. I originally had no
link from plain libjpeg.so to the libjpeg.62... files which were
actually present, so setup.py bypassed JPEG entirely. When I made that
link, it accepted JPEG but then failed at the compile stage. Installing
the headers gave me a full PIL.
Hope that's helpful.
-- Pete --
More information about the Image-SIG