[l2h] pnmtopng problem

Ellis, Nick (Marine, Cleveland) Ellis, Nick (Marine, Cleveland)" <Nick.Ellis@cmis.csiro.au
Wed, 28 Jul 1999 17:54:34 +1000


Dear latex2html community,

I've run into some trouble trying to use latex2html and the problem is in
the installation of pnmtopng. I realize this is somewhat off-topic for this
list, but I'm hoping someone has had experience with this issue. And the
only reason I installed pnmtopng was to use latex2html anyway!

The problem:
I'm having trouble getting pnmtopng running on my machine. It's a Solaris
machine, System V version 4.0. The program appears to install correctly, but
it gives an error message when I try to run it. I've included a fragment
from the output of the latex2html command in case it's relevant. The place
where it breaks down is a pipe, which I've broken into 2 commands here:

unix% /home/ell201/netpbm/bin/ppmquant -floyd 256 < image017.ppm > tmp
ppmquant: making histogram...
ppmquant: 16 colors found
ppmquant: choosing 256 colors...
ppmquant: mapping image to new colors...
unix% /home/ell201/netpbm/bin/pnmtopng < tmp
ld.so.1: /home/ell201/netpbm/bin/pnmtopng: fatal: libpng.so.2: can't open
file:
errno=2
Killed

As you can see, if I run these commands in isolation I get the same problem.

The only ideas I've had as to the cause of the problem is the non-standard
directory structure. That is the .a files are in a different part of the
directory tree from the .h files and the binaries are all together in
netpbm/bin. See makefile for -L and -I options. Another idea is maybe I'm
missing some compiler or link option specific to Solaris systems.

Any pointers would be gratefully received. 

Thanks for reading.

Nick Ellis
CSIRO Marine Research	mailto:Nick.Ellis@marine.csiro.au
PO Box 120			ph    +61 (07) 3826 7260
Cleveland QLD 4163    	fax   +61 (07) 3826 7222
Australia			http://www.marine.csiro.au


Fragments from the latex2html
job:==============================================================
Using ./ as tmp directory

current directory is /home/ell201/f9515/tst/ ...

temp directory is ./ ...
pstoimg: Page dimensions are 595x842
Running /home/ell201/gs/bin/gs -q -dNOPAUSE -dNO_PAUSE  -sDEVICE=ppmraw
-g36x53  -r115 -dTextAlphaBits=4  -sOutputFile=image017.ppm
GS>-85 -754 translate
GS>(image017.ps) run
GS>quit
GS>
Running /home/ell201/netpbm/bin/pnmcrop < image017.ppm |
/home/ell201/netpbm/bin/pnmcrop -bot | /home/ell201/netpbm/bin/pnmcrop -l  >
image017.ppm.tmp
pnmcrop: cropping 27 rows off the top
pnmcrop: cropping 5 rows off the bottom
pnmcrop: cropping 8 cols off the left
pnmcrop: cropping 12 cols off the right
pnmcrop: cropping 3 rows off the bottom
pnmcrop: cropping 2 cols off the left
Running /home/ell201/netpbm/bin/pnmcrop -bot < image017.ppm  >
image017.ppm.tmp 2>shave.msg
Image is PPM, 14x18
Running /home/ell201/netpbm/bin/ppmquant -floyd 256 < image017.ppm |
/home/ell201/netpbm/bin/pnmtopng -interlace -trans '#ffffff'  > img17.png
ppmquant: making histogram...
ppmquant: 16 colors found
ppmquant: choosing 256 colors...
ppmquant: mapping image to new colors...
ld.so.1: /home/ell201/netpbm/bin/pnmtopng: fatal: libpng.so.2: can't open
file: errno=2
Killed
pstoimg: Conversion failed: Illegal seek

Output image is in file: ./img17.png


How I created the
installation::=============================================================
the makefile:

# Makefile for pnmtopng/pngtopnm for gcc 2.7 or later (Linux, Solaris, etc.)
# Copyright (C) 1995-1998 Willem van Schaik

CC = gcc
CP = cp
RM = rm

# change to match your directories
#
# it is suggested that you place things like libpng and zlib in 
# version-specific directories like ../zlib-1.0 and that you make a 
# symbolic link like "ln -s zlib-1.0 zlib" in the .. directory 
#
# if the libraries and header files are already installed in /usr/lib and 
# /usr/include, just set the "INC" and "LIB" variables to empty strings and
# set the "LIB2" variables to /usr/lib/lib<whatever>.a

#PNGDIR = ../libgr2/png
PNGDIR = /home/ell201/temp/gs/libpng
PNGINC = -I$(PNGDIR)
#PNGLIB = -L$(PNGDIR) -lpng
#PNGLIB2 = $(PNGDIR)/libpng.a

#PNGDIR = ../libgr2/zlib
ZDIR = /home/ell201/temp/gs/zlib
ZINC = -I$(ZDIR)
#ZLIB = -L$(ZDIR) -lz
#ZLIB2 = $(ZDIR)/libz.a

#PBMDIR = /usr/local/netpbm
#PBMDIR = ../libgr2
PBMDIR = /home/ell201/netpbm
PBMINC = -I$(PBMDIR)/pnm -I$(PBMDIR)/ppm -I$(PBMDIR)/pgm -I$(PBMDIR)/pbm
PBMLIB = -L$(PBMDIR)/lib -L$(PBMDIR)/pnm -L$(PBMDIR)/ppm -L$(PBMDIR)/pgm
-L$(PBMDIR)/pbm \
	 -lpnm -lppm -lpgm -lpbm
PBMLIB2 = $(PBMDIR)/pnm/libpnm.a $(PBMDIR)/ppm/libppm.a \
	  $(PBMDIR)/pgm/libpgm.a $(PBMDIR)/pbm/libpbm.a

ZLIB = -L$(PBMDIR)/lib -lz
ZLIB2 = $(PBMDIR)/lib/libz.a
PNGLIB = -L$(PBMDIR)/lib -lpng
PNGLIB2 = $(PBMDIR)/lib/libpng.a

# where "make install" puts pnmtopng and pngtopnm

INSTDIR = $(PBMDIR)


CFLAGS = -O3 -Wall -D_BSD_SOURCE $(PNGINC) $(ZINC) $(PBMINC)
LDFLAGS = $(PNGLIB) $(ZLIB) $(PBMLIB) -lm
LDFLAGS2 = $(PNGLIB2) $(ZLIB2) $(PBMLIB2) -lm

MANS = pnmtopng.1 pngtopnm.1
SRCS = pnmtopng.c pngtopnm.c
OBJS = pnmtopng.o pngtopnm.o
EXES = pnmtopng pngtopnm pnmtopng-static pngtopnm-static


# dependency rules

all: $(EXES)

pnmtopng: pnmtopng.o
	$(CC) -o $@ pnmtopng.o $(LDFLAGS)

pngtopnm: pngtopnm.o
	$(CC) -o $@ pngtopnm.o $(LDFLAGS)

pnmtopng-static: pnmtopng.o
	$(CC) -o $@ pnmtopng.o $(LDFLAGS2)

pngtopnm-static: pngtopnm.o
	$(CC) -o $@ pngtopnm.o $(LDFLAGS2)

install: all
	$(CP) $(EXES) $(INSTDIR)/bin
	$(CP) $(MANS) $(INSTDIR)/man/man1

clean:
	$(RM) -f $(OBJS) $(EXES)


# end of Makefile.gcc

make commands:
gcc -O3 -Wall -D_BSD_SOURCE -I/home/ell201/temp/gs/libpng
-I/home/ell201/temp/gs/zlib -I/home/ell201/netpbm/pnm
-I/home/ell201/netpbm/ppm -I/home/ell201/netpbm/pgm
-I/home/ell201/netpbm/pbm  -c  pnmtopng.c
gcc -o pnmtopng pnmtopng.o -L/home/ell201/netpbm/lib -lpng
-L/home/ell201/netpbm/lib -lz -L/home/ell201/netpbm/lib
-L/home/ell201/netpbm/pnm -L/home/ell201/netpbm/ppm
-L/home/ell201/netpbm/pgm -L/home/ell201/netpbm/pbm  -lpnm -lppm -lpgm -lpbm
-lm
gcc -O3 -Wall -D_BSD_SOURCE -I/home/ell201/temp/gs/libpng
-I/home/ell201/temp/gs/zlib -I/home/ell201/netpbm/pnm
-I/home/ell201/netpbm/ppm -I/home/ell201/netpbm/pgm
-I/home/ell201/netpbm/pbm  -c  pngtopnm.c
gcc -o pngtopnm pngtopnm.o -L/home/ell201/netpbm/lib -lpng
-L/home/ell201/netpbm/lib -lz -L/home/ell201/netpbm/lib
-L/home/ell201/netpbm/pnm -L/home/ell201/netpbm/ppm
-L/home/ell201/netpbm/pgm -L/home/ell201/netpbm/pbm  -lpnm -lppm -lpgm -lpbm
-lm
gcc -o pnmtopng-static pnmtopng.o /home/ell201/netpbm/lib/libpng.a
/home/ell201/netpbm/lib/libz.a /home/ell201/netpbm/pnm/libpnm.a
/home/ell201/netpbm/ppm/libppm.a  /home/ell201/netpbm/pgm/libpgm.a
/home/ell201/netpbm/pbm/libpbm.a -lm
gcc -o pngtopnm-static pngtopnm.o /home/ell201/netpbm/lib/libpng.a
/home/ell201/netpbm/lib/libz.a /home/ell201/netpbm/pnm/libpnm.a
/home/ell201/netpbm/ppm/libppm.a  /home/ell201/netpbm/pgm/libpgm.a
/home/ell201/netpbm/pbm/libpbm.a -lm
cp pnmtopng pngtopnm pnmtopng-static pngtopnm-static /home/ell201/netpbm/bin
cp pnmtopng.1 pngtopnm.1 /home/ell201/netpbm/man/man1

directory structure under
netpbm::==============================================================

/home/ell201/netpbm:
bin include lib man pbm pgm pnm ppm

/home/ell201/netpbm/bin:
.. lots of binaries ...

/home/ell201/netpbm/include:

/home/ell201/netpbm/lib:
libpbm.a
libpgm.a
libpng.a
libpng.so
libpng.so.2
libpng.so.2.1.0.3
libpnm.a
libppm.a
libtiff.a
libz.a

/home/ell201/netpbm/man:
man1
man3
man5

...manuals etc...

/home/ell201/netpbm/pbm:
libpbm.a
pbm.h
pbmplus.h

/home/ell201/netpbm/pgm:
libpgm.a
pgm.h

/home/ell201/netpbm/pnm:
libpnm.a
pnm.h

/home/ell201/netpbm/ppm:
libppm.a
ppm.h
ppmcmap.h