[Image-SIG] Solution to PIL _imaging.so Solaris compile problem

Chris Kant chris@decal.co.uk
Thu, 27 Jun 2002 15:35:31 +0100


We had a lot trouble with trying to compile the PIL _imaging.so on 
Solaris 7 on a Sparc 5 (we had to compile on each sun4m and sun4u 
architecture boxes as there appeared to be a mismatch otherwise). We 
compiled on an Enterprise 250 with no trouble.


Have seen a few other mails with similar issues, eg.

"text relocation remains against symbol" and
"ld: fatal: relocations remain against allocatable but non-writable 
sections"

plus lots of unknown errors.

The solution worked out is as follows:

The problem was caused by the libImaging subdirectory compiling without 
the -fPIC flag which indicates that the
object files need not have a fixed load address. To fix this, add -fPIC 
to the CFLAGS in the Makefile AFTER running
configure BEFORE issuing the make command. You can then build 
_imaging.so in the directory above.

Incidentally, I had a further problem in building libImaging.a in that 
the configure script required the
--with-jpeg=/usr/local/lib and --with-zlib=/usr/local/lib arguments and 
this caused the configure script to fail to
run programs calculating the size of char, size of int etc. On 
investigation, the scripts creates a C program
conftest.c which prints the relevant type size into a file conftestval 
and because this was compiled with the
-L/usr/local/lib -lz flags, it required the libz.so in its 
LD_LIBRARY_PATH. I was connected using telnet as a newly
created login and so this was not set up correctly.

In summary, running the csh, I had to

1. setenv LD_LIBRARY_PATH /usr/local/lib # where the libjpeg.so and 
zlib.so shared libraries reside
in the libImaging subdirectory
2. configure --with-jpeg=/usr/local/lib --with-zlib=/usr/local/lib
2. add -fPIC to the "configure"d Makefile's CFLAGS by editing
3. make # makes libImaging.a
4. cd ..; make # after editing out the tk stuff from the Setup.in
5. python setup.py build
5. python setup.py install

This then allows the PIL/_imaging.so shared library to be imported by 
the PIL/Image.py module.




-- 
Chris Kant
for DeCAL
Edinburgh
tel: 0131 553 3159