[Image-SIG] [PIL installation] missing ANSI C headers on Solaris =>
my solution and suggestions
perry.tew at cibavision.novartis.com
perry.tew at cibavision.novartis.com
Tue Sep 2 08:16:33 EDT 2003
Hello all,
I'm new to python and spent some time Friday installing PIL using the
following configuration:
OS: SunOS usatux29 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Fire-280R
python: packaged with Zope (python 2.1.3)
At any rate, I ran into several issues with the install. After being
unable to find resolutions
addressed in a mailing list anywhere I decided to post this in hopes of
helping others down the line.
At the end of this email I list the correct steps for installing PIL on a
solaris box. Note, in the examples
below you'll see Imaging-1.1.2. That was my playground. The same applies
to Imaging-1.1.4
=========================================================================
BOTTOM LINE
Most of my problems were because I did not have the directory containing
libjpeg in my LD_LIBRARY_PATH environment variable.
=========================================================================
Symptons I received as a result, when I ran configure:
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >./configure
creating cache ./config.cache
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for ranlib... ranlib
checking for ar... ar
checking MACHDEP... sunos5
checking for jpeg_destroy_compress in -ljpeg... yes
checking for deflate in -lz... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... no
checking for inline... inline
checking whether byte ordering is bigendian... yes
checking size of char... 0
checking size of short... 0
checking size of int... 0
checking size of long... 0
checking size of float... 0
checking size of double... 0
checking for working const... yes
checking for prototypes... yes
checking for unistd.h... yes
checking for getpagesize... yes
checking for working mmap... no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating ImConfig.h
Then, when running make, I received the following errors:
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >make
gcc -O -I./. -I/usr/local/include -DHAVE_CONFIG_H -c coretest.c
In file included from Imaging.h:21,
from coretest.c:19:
ImPlatform.h:18: #error Sorry, this library requires ANSI header files.
ImPlatform.h:36: #error Cannot find required 32-bit integer type
ImPlatform.h:48: #error Cannot find required 32-bit floating point type
*** Error code 1
make: Fatal error: Command failed for target `coretest.o'
The confusing parts about the configure process were these lines of
output:
checking for ANSI C header files... no
...
checking size of char... 0
checking size of short... 0
checking size of int... 0
checking size of long... 0
checking size of float... 0
checking size of double... 0
I looked in my config.log and found the C code used by configure to test
these
parts of my system. The reason all of these tests were failing was that
configure
was passing -ljpeg as a gcc compiler option. Since I did not have libjpeg
in my
ld path, the compilation failed and I received the errors above.
=========================================================================
SOLUTIONS
Once I did the added the directory containing libjpeg to my ld path,
configure produced different output and make worked as desired:
# where is my libjpeg??
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >find / -name
"libjpeg*"
/opt/sfw/lib/libjpeg.so
/opt/sfw/lib/libjpeg.so.1
/opt/sfw/lib/libjpeg.so.6
... additional places, like java's directory, etc
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sfw/lib
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >make distclean
[tewpe1 at usatux29] /opt/cmf/PIL/Imaging-1.1.2/libImaging >./configure
creating cache ./config.cache
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for ranlib... ranlib
checking for ar... ar
checking MACHDEP... sunos5
checking for jpeg_destroy_compress in -ljpeg... yes
checking for deflate in -lz... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for inline... inline
checking whether byte ordering is bigendian... yes
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 4
checking size of float... 4
checking size of double... 8
checking for working const... yes
checking for prototypes... yes
checking for unistd.h... yes
checking for getpagesize... yes
checking for working mmap... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating ImConfig.h
Looks much better now!
I would assume that the location of libjpeg will vary on systems,
but the find command will point anyone to the correct location.
=========================================================================
SUMMARY OF STEPS FOR INSTALLING PIL ON SOLARIS:
gtar zxvf Imaging-1.1.2.tar.gz
cd Imaging-1.1.2/libImaging
export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/the/directory/containing/libjpeg
./configure
edit Makefile and add -fPIC to the end of the CFLAGS variable ( about line
36? )
make
make check
cd ..
make -f Makefile.pre.in boot
edit Setup.in and added -L/opt/sfw/lib to the libjpeg specification,
also commented out the tk stuff since I'm not using it
make
make install
=========================================================================
SUGGESTIONS:
First, to the authors of PIL, thanks for the software.
I am grateful for the use of it. I hope that these suggestions will be
perceived
as such and not complaining.
1. The README gives the appearance that the jpeg library is optional, when
it's not since
configure doesn't produce the correct output without libjpeg in the ld
path.
"""
If you need JPEG and/or PNG support, make sure to get and build
the necessary external libraries:
- for JPEG support, get the IJG JPEG library, version 6a or 6b.
You can find this library here:
http://www.ijg.org
ftp://ftp.uu.net/graphics/jpeg/
"""
Should this be changed to remove the If?
2. The configure process should run a test specifically for libjpeg and
fail with an error
message stating that it could not be loaded and is needed by the program.
If this
were done at the beginning of the build process, I believe it would be
enough
information for an admin or developer to make the adjustments necessary to
install PIL.
3. Is there a way to remove the jpeg and z library dependencies for the
ASNI C header check
and the sizeof checks? I don't know the GNU Autoconf toolset very well,
but
I think a check for sizeof should only fail if the sizeof C call fails,
and not for a
missing library that isn't used in the actual C code.
4. I didn't have xv on my system, so I received a non-fatal error
while running 'make check'. It would be useful if it were documented in
the
README or elsewhere that a successful make check depended on xv.
Well, I hope this information is found useful by others. If I haven't got
something quite right,
please let me know.
Thanks,
Perry Tew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20030902/ad07969e/attachment-0001.htm
More information about the Image-SIG
mailing list