Short answer:
First off, following the instructions in BUILD-NTOP.txt works fine, although
that means that the libraries are static, hard-coded, etc.
What I found was that RedHat 7.2 installed a libgd.so.1.8.4 library, which
was compiled against 1.0.x series of libpng (which is fine, because RedHat
7.2 includes libpng-1.0.12).
Unfortunately, there aren't more recent RedHat packages for the required set
(libpng-1.2.2, zlib-1.1.4 and gd-1.8.4).
Brief instructions for manually updating libgd.so.1.8.4 (this assumes you've
installed libpng 1.2.2 from source in the default location).
1) Obtain the source rpm and install it:
cd /usr/src/redhat/SRPMS
wget
ftp://ftp.redhat.com/pub/redhat/linux/7.2/en/os/i386/SRPMS/gd-1.8.4-4.src.rp
m
rpm -i gd-1.8.4-4.src.rpm
Which gives you 2 files in /usr/share/redhat/SOURCES:
gd-1.8.4.tar.gz
and
gd-1.8.4-redhat.patch
2) Unpack the .tar.gz file into a work directory and apply the patch
cd ~
tar xfvz /usr/src/redhat/SOURCES/gd-1.8.4.tar.gz
cd gd-1.8.4
patch -p1 < /usr/src/redhat/SOURCES/gd-1.8.4-redhat.patch >> patchlog
3) Edit Makefile
Change CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG
to CFLAGS=-fpic -O -DHAVE_LIBPNG -DHAVE_LIBJPEG
Change LIBS=-lgd -lpng -lz -lm
to LIBS=-lgd -lpng -lz -lm -ljpeg
Change INCLUDEDIRS=-I. -I/usr/include/freetype2
to INCLUDEDIRS=-I. -I/usr/include/freetype2 -I/usr/include/libpng12
4) make && make install
5) Create and install the shared library...
gcc --shared -o libgd.so.1.8.4 gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o
\
gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gd_jpeg.o \
gdxpm.o gdfontt.o gdfonts.o gdfontmb.o gdfontl.o \
gdfontg.o gdtables.o gdft.o gdttf.o gdcache.o gdkanji.o
\
wbmp.o gd_wbmp.o gdhelpers.o /usr/lib/libjpeg.so
install -v -m 644 libgd.so.1.8.4 /usr/lib/libgd.so.1.8.4
chmod +x /usr/lib/libgd.so.1.8.4
Stop & restart ntop
-----Burton
========================================================
Long answer:
>From the directory name, you're running against a cvs pull. Since the
directory names have changed, I don't think a simple cvs update will work...
Or, do you have libpng, gdchart, etc. really installed (vs. using the
version that "comes" with gdchart??). (I actually have RedHat 7.2, so I had
libpng-1.0.12 installed as a real library.)
That's the key - at least for me...
Basically, I proceeded to update the libraries I had installed on my RedHat
system (zlib-1.1.3 -> 1.1.4 and libpng-1.0.12 -> 1.2.2). I had to do this
manually, as there are no rpms yet:
zlib
Followed instructions, worked cleanly:
./configure --shared -prefix=/usr
make
make install
System rebooted ok, etc.
libpng
copied makefile.linux -> "Makefile"
Edited for /usr/local -> /usr
Also had to edit Makefile from
pngtest-static: pngtest.o $(LIBNAME).a
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
to
pngtest-static: pngtest.o libpng.a
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
make test
make install
Then I build the gdchart stuff, again installing it as real libraries vs.
the static versions usually used with ntop...
gdchart 0.94c (source is from the ntop-cvs)
gd-1.8.3 first with a couple of Makefile changes:
INCLUDEDIRS=-I. -I/usr/include -I/usr/include/libpng12 -I/usr/include/X11 -I
/usr/X11R6/include/X11
and
LIBS=-lm -lgd -lz -lpng
(Plus the usual /usr/local -> /usr changes)
make
make install
then gdchart...
rm -r gd-1.8.3
Updated the directories
GDC_INCL = /usr/include
GD_INCL = /usr/include
GD_LIB = /usr/lib
./configure --prefix=/usr
make
Manually copied libgdchart.a to /usr/lib:
install -v -m 644 libgdchart.a /usr/lib/libgdchart.a
ntop...
cd ..
rm -r gdchart0.94c
cd ntop
Then I did my usual patch to configure.in to adjust locations:
--- ntop/configure.in~ Thu Dec 27 11:40:55 2001
+++ ntop/configure.in Fri Dec 28 07:53:54 2001
@@ -876,12 +876,12 @@
if test ".${GDCHART_ROOT}" != .; then
if test -d $GDCHART_ROOT &&
- test -r $GDCHART_ROOT/libgdchart.a &&
- test -r $GDCHART_ROOT/gdc.h &&
- test -r $GDCHART_ROOT/gd-1.8.3/libgd.a &&
- test -r $GDCHART_ROOT/gd-1.8.3/gd.h &&
- test -r $GDCHART_ROOT/zlib-1.1.4/libz.a; then
+ test -r $GDCHART_ROOT/lib/libgdchart.a &&
+ test -r $GDCHART_ROOT/include/gdc.h &&
+ test -r $GDCHART_ROOT/lib/libgd.a &&
+ test -r $GDCHART_ROOT/include/gd.h &&
+ test -r $GDCHART_ROOT/lib/libz.so; then
GDCHART_ROOT=`cd ${GDCHART_ROOT} && pwd`
-
MORELIBS="${MORELIBS} -L$GDCHART_ROOT -lgdchart -L$GDCHART_ROOT/gd-1.8.3 -lg
d -L$GDCHART_ROOT/gd-1.8.3/libpng-1.2.1 -lpng -L$GDCHART_ROOT/zlib-1.1.4 -lz
"
- INCS="${INCS} -I$GDCHART_ROOT -I$GDCHART_ROOT/zlib-1.1.4"
+
MORELIBS="${MORELIBS} -L$GDCHART_ROOT/lib -lgdchart -lgd -lpng -lz"
+ INCS="${INCS} -I$GDCHART_ROOT/include -I$GDCHART_ROOT/zlib-1.1.4"
AC_DEFINE(HAVE_GDCHART)
AC_MSG_RESULT([found in $GDCHART_ROOT])
./autogen.sh -1
./configure --prefix=/usr --with-gdchart-root=/usr
This is your ntop 2.0.99 configuration:
Host System Type : i686-pc-linux-gnu
Compiler (cflags) : gcc -g -O2 -pipe -DHAVE_CONFIG_H
Include path
: -I/usr/include/pcap -I/usr/include -I/usr/zlib-1.1.4 -I/usr/include/opens
sl
System Libs : -lpthread -lresolv -lnsl -lc -ldl
Core Libs : -lpcap -lgdbm
Additional Libs
: -L/usr/lib/mysql -lmysqlclient -lcrypt -lm -lz -L/usr/lib -lgdchart -lgd
-lpng -lz -lssl -lcrypto
LBL pcap in : semi-standard installation
GNU gdbm in :
MultiThread mode : yes
Install path : /usr
make clean
make
su -
make install
/usr/bin/ntop -i ....
*************************************
** With the same result you had... **
*************************************
libpng warning: Application was compiled with png.h from libpng-1.0.12
libpng warning: Application is running with png.c from libpng-1.2.2
Then I did it all over again, being absolutely sure I deleted subdirectories
from the gdchart0.94c stuff after each step...
SAME DAMN RESULT...
So, I started poking with ldd etc. and found this:
[root@tigger ntop]# ls -l /usr/lib/libgd.*
-rw-r--r-- 1 root root 187906 Apr 18 10:31 /usr/lib/libgd.a
lrwxrwxrwx 1 root root 14 Feb 11 02:00 /usr/lib/libgd.so ->
libgd.so.1.8.4
lrwxrwxrwx 1 root root 14 Feb 11 01:24
/usr/lib/libgd.so.1 -> libgd.so.1.8.4
lrwxrwxrwx 1 root root 14 Feb 11 01:24
/usr/lib/libgd.so.1.8 -> libgd.so.1.8.4
-rwxr-xr-x 1 root root 196866 Aug 13 2001
/usr/lib/libgd.so.1.8.4
Culprit?? Where did it come from? Answer: the gd-1.8.4-4.rpm...
Well, then, all I need to do is remake libgd.so... with the new version,
linked against the new libpng, right??
poking in the gd-1.8.3 directory and found this:
Version 1.7 contains the following changes:
...
* autoconf and configure have been removed, in favor of a carefully
designed Makefile which produces and properly installs the library
and the binaries. System-dependent variables are at the top of the
Makefile for easy modification. I'm sorry, folks, but autoconf
generated _many, many confused email messages_ from people who
didn't have things where autoconf expected to find them. I am not
an autoconf/automake wizard, and gd is a simple, very compact
library which does not need to be a shared library. I _did_ make
many improvements over the old gd 1.3 Makefile, which were
directly inspired by the autoconf version found in the 1.6 series
(thanks to John Ellson).
vs.
What's new in version 1.6.2?
...
Also in this release the build process has been converted to GNU
autoconf/automake/libtool conventions so that both (or either) static
and shared libraries can be built.
So there isn't anything in the Makefile to help...
So, I rebuilt the libgd.so.1.8.4 from the rpm source for 1.8.4
Make changes to the Makefile to point at the right header locations,
/usr/local -> /usr
Manually created the .so.1.8.4 file:
gcc --shared -o libgd.so.1.8.4 gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o
gd_io_file.o gd_ss.o \
> gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o gdfontt.o gdfonts.o
gdfontmb.o gdfontl.o \
> gdfontg.o gdtables.o gdft.o gdttf.o gdcache.o gdkanji.o wbmp.o \
> gd_wbmp.o gdhelpers.o /usr/lib/libjpeg.so
mv /usr/lib/libgd.so.1.8.4 /usr/lib/libgd.so.1.8.4-save
install -v -m 644 libgd.so.1.8.4 /usr/lib/libgd.so.1.8.4
Giving:
[root@tigger gd-1.8.4]# ls -l /usr/lib/libgd.*
-rw-r--r-- 1 root root 187906 Apr 18 10:31 /usr/lib/libgd.a
lrwxrwxrwx 1 root root 14 Feb 11 02:00 /usr/lib/libgd.so ->
libgd.so.1.8.4
lrwxrwxrwx 1 root root 14 Feb 11 01:24
/usr/lib/libgd.so.1 -> libgd.so.1.8.4
lrwxrwxrwx 1 root root 14 Feb 11 01:24
/usr/lib/libgd.so.1.8 -> libgd.so.1.8.4
-rw-r--r-- 1 root root 187647 Apr 18 11:21
/usr/lib/libgd.so.1.8.4
-rwxr-xr-x 1 root root 196866 Aug 13 2001
/usr/lib/libgd.so.1.8.4-save
IT RUNS!!!!
-----Burton
-----Original Message-----
From: Steve Cooper [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 8:51 AM
To: Burton M. Strauss III; Luca Deri; [EMAIL PROTECTED]
Subject: Segmentation fault: libpng warning: Application was compiled
with png.h from libpng-1.0.8,libpng warning: Application is running with
png.c from libpng-1.2.1,gd-png: fatal libpng error: Incompatible libpng
version in application and library
18/Apr/2002 22:47:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:217
18/Apr/2002 22:47:48 readLsofInfo completed (2 sec).
18/Apr/2002 22:49:22 Purging completed in 0 sec [3 hosts deleted]
18/Apr/2002 22:54:26 Purging completed in 0 sec [2 hosts deleted]
18/Apr/2002 23:04:34 Purging completed in 0 sec [3 hosts deleted]
18/Apr/2002 23:07:39 WARNING: Index 32 out of range [0..32] @ pbuf.c:209
18/Apr/2002 23:07:39 WARNING: Index 32 out of range [0..32] @
sessions.c:1281
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:217
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:209
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @
sessions.c:1042
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:209
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:217
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:217
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:209
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:209
18/Apr/2002 23:07:40 WARNING: Index 32 out of range [0..32] @ pbuf.c:217
18/Apr/2002 23:09:38 Purging completed in 0 sec [1 hosts deleted]
18/Apr/2002 23:10:36 Index error idx=93/deviceId=0:0-32 @
[reportUtils.c:2149]
libpng warning: Application was compiled with png.h from libpng-1.0.8
libpng warning: Application is running with png.c from libpng-1.2.1
gd-png: fatal libpng error: Incompatible libpng version in application and
library
./cvs-ntop: line 13: 11942 Segmentation fault
hmmmm.... what the fudge
this is a new one to me!
l8r
Steve
--
################################################################
Steve Cooper:- IT System Analyst
Australian Taxation Office:- Small Business Electronic Commerce
Email:- [EMAIL PROTECTED] <- please use this address
[EMAIL PROTECTED]
Phone:- 62163337/
ICQ:- 108978101
################################################################
--------------------------------------------------------
Note to the masses:
Folks.... Rule of thumb. If it says beta, the chances are good that unless
you are a developer of some kind with good skills, you *are* going to break
your system. When the docs say might, read might as *WILL*. Beta is for
testing... and tests fail.
--------------------------------------------------------
_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listmanager.unipi.it/mailman/listinfo/ntop