[Image-SIG] can't compile PIL on hpux 11.00 - solution

Gansser, Martin MGansser@rand.de
Wed, 25 Sep 2002 17:39:58 +0200


> -----Original Message-----
> From: Calvin [mailto:calvin@xmission.com]
> Sent: Wednesday, September 25, 2002 4:41 PM
> To: Gansser, Martin
> Subject: Re: [Image-SIG] can't compile PIL on hpux 11.00
>=20
>=20
> > build/temp.hp-ux-B.11.00-9000/785-2.2/path.o -LlibImaging=20
> -lImaging =3D
> > -ljpeg -lz -o build/lib.hp-ux-B.11.00-9000/785-2.2/_imaging.sl
> > ld: Can't find library: "jpeg"
> > error: command 'ld' failed with exit status 1
>=20
> hmmm...I'm kinda shooting in the dark here, but I've had=20
> problems with=20
> every build of PIL with jpeg on Mac OS X. =20
>=20
> One recommendation I have is to do it the old fashioned=20
> way...with make=20
> instead of python setup.py build.  Read the README and it=20
> talks about how=20
> to do that.=20
>=20
> however, looking at where the failure is, it looks like the=20
> last line of=20
> this segment of code from setup.py may be your culprit:
> ----------
> # parse ImConfig.h to figure out what external libraries we're using
> for line in open(os.path.join("libImaging",=20
> "ImConfig.h")).readlines():
>     m =3D re.match("#define\s+HAVE_LIB([A-Z]+)", line)
>     if m:
>         lib =3D m.group(1)
>         if lib =3D=3D "JPEG":
>             HAVE_LIBJPEG =3D 1
>             if sys.platform =3D=3D "win32":
>                 LIBRARIES.append("jpeg")
>                 INCLUDE_DIRS.append(JPEGDIR)
>                 LIBRARY_DIRS.append(JPEGDIR)
>             else:
>                 LIBRARIES.append("jpeg")
> ----------
>=20
> try specifying your library... "/usr/local/lib" and see if=20
> that works.  I=20
> only suggest this because it's saying "library "jpeg" not found"  =
which=20
> means it's looking for a library called "jpeg" instead of a=20
> library called  "/usr/local/lib"

I made the following modifications on my hpux 11.00 machine,
Imaging compiles now.

diff -Naur Imaging-1.1.3/libImaging/Makefile.in =
Imaging-1.1.3.new/libImaging/Makefile.in
--- Imaging-1.1.3/libImaging/Makefile.in	2002-09-25 17:32:31.000000000 =
+0200
+++ Imaging-1.1.3.new/libImaging/Makefile.in	2002-09-25 =
17:33:02.000000000 +0200
@@ -34,6 +34,7 @@
 OPT=3D		@OPT@
 #OPT=3D		-g
 CFLAGS=3D		$(OPT) -I$(INCLDIR) -I$(JPEGINCLUDE) $(DEFS)
+LFLAGS=3D		-L/usr/local/lib
=20
 MKDEP=3D		mkdep
 SHELL=3D		/bin/sh
@@ -81,7 +82,7 @@
 all:		coretest $(LIB)
=20
 coretest:	coretest.o $(LIB)
-		$(CC) -o coretest coretest.o $(LIB) $(LIBS)
+		$(CC) -o coretest coretest.o $(LIB) $(LFLAGS) $(LIBS)
=20
 $(LIB):		$& $(OBJS)
 		-rm -f $(LIB)
diff -Naur Imaging-1.1.3/setup.py Imaging-1.1.3.new/setup.py
--- Imaging-1.1.3/setup.py	2002-03-14 20:55:04.000000000 +0100
+++ Imaging-1.1.3.new/setup.py	2002-09-25 17:29:54.000000000 +0200
@@ -60,7 +60,7 @@
                 INCLUDE_DIRS.append(JPEGDIR)
                 LIBRARY_DIRS.append(JPEGDIR)
             else:
-                LIBRARIES.append("jpeg")
+                LIBRARIES.append("/usr/local/lib/jpeg")
         elif lib =3D=3D "TIFF":
             HAVE_LIBTIFF =3D 1
             LIBRARIES.append("tiff")
@@ -71,7 +71,7 @@
                 INCLUDE_DIRS.append(ZLIBDIR)
                 LIBRARY_DIRS.append(ZLIBDIR)
             else:
-                LIBRARIES.append("z")
+                LIBRARIES.append("/usr/local/lib/z")
=20
 if sys.platform =3D=3D "win32":
     # standard windows libraries
@@ -148,7 +148,7 @@
         LIBRARIES.extend(["tk" + version, "tcl" + version])
     else:
         # assume the libraries are installed in the default location
-        LIBRARIES.extend(["tk" + TCL_VERSION, "tcl" + TCL_VERSION])
+        LIBRARIES.extend(["/usr/local/lib/tk" + TCL_VERSION, =
"/usr/local/lib/tcl" + TCL_VERSION])
=20
     MODULES.append(
         Extension(

thanks for you help

Martin