I managed to solve this...

I started mangling around with the cvs version and came to the point it
compiled ok (with rrdtool), but at startup it segfaulted.

After looking at the strace output for the billion time, I saw this:

munmap(0x402d4000, 41809)               = 0
uname({sys="Linux", node="lbox", ...})  = 0
open("/etc/passwd", O_RDONLY)           = 4
shmat(4, 0x1, 0x1)                      = ?
shmat(4, 0x2, 0x2)                      = ?
fstat64(0x4, 0xbfffefc8)                = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x402d4000
_llseek(4, 0, [0], SEEK_CUR)            = 0
read(4, "root:x:0:0::/root:/bin/bash\nbin:"..., 4096) = 4096
close(4)                                = 0
munmap(0x402d4000, 4096)                = 0


Which led me, to try and run ntop with specific user (ok, root, just to
test) and ta-da it worked... so I found out, if I don't specify -u it
segfaults.

After that I ran into the ussual rrd plugin problems (compiled with png.h
1.0.4, runs with 1.2.4, or something similar), which I managed to solved
with the FAQ and some google search on the ntop mailing list(s) => had old
libpng, etc... after all this is slackware 8 machine, "upgraded" to be
somewhat 8.1 or more... 

I hope someone benefits from this, that's why I replied to my own problem.

Again, thank you Burton and Luca for all the help!

A.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Burton
M. Strauss III
Sent: Tuesday, July 15, 2003 1:01 PM
To: [EMAIL PROTECTED]
Subject: RE: [Ntop] problems compiling ntop 2.2c with rrdtool 1.42


Look--

READ the back traffic on 'size of symbol changed'.  It means you have a
conflict between the version of the shared library (be it libpcap, libgd,
whatever) that was used to compile ntop with vs the version that was used to
link ntop with.

Long answer, AGAIN, even LONGER this time...


If you break down the link line

gcc -shared  address.lo ... ntop_darwin.lo
    -L/usr/local/include -L/usr/local/lib -L/linuxadmin/ntop/ntop2.2.3/ntop-
2.2.3/myrrd
    -lpthread -lresolv -lnsl -lz -lc -lssl -lcrypto -lgd -lpng -lpcap
/usr/lib/libgdbm.so -lmyrrd
   -Wl,-soname -Wl,libntop-2.2.3.so
   -o .libs/libntop-2.2.3.so

The -L parameters ADD additional places to look for the shared libraries,
which are in addition to the 'standard locations' for the system.  The
'standard locations' are very system dependent, but usually include /usr/lib
and /lib.  PLUS whatever is (under Linux) in the ld.so.conf file...

So, on my system:

$ man ld.so

NAME
       ld.so, ld-linux.so* - dynamic linker/loader

DESCRIPTION
       ld.so loads the shared libraries needed by a program, prepares the
pro-
       gram to run, and then runs it.  Unless  explicitly  specified  via
the
       -static  option to ld during compilation, all Linux programs are
incom-
       plete and require further linking at run time.

       The necessary shared libraries needed by the program are  searched
for
       in the following order

       o      Using  the  DT_RPATH  dynamic section attribute of the binary
if
              present and DT_RUNPATH attribute does not exist.

       o      Using the environment variable LD_LIBRARY_PATH .  Except if
the
              executable  is  a  setuid/setgid  binary,  in  which  case it
is
              ignored.

       o      Using the DT_RUNPATH dynamic section attribute of the binary
if
              present.

       o      From  the  cache file /etc/ld.so.cache which contains a
compiled
              list of candidate libraries previously found  in  the
augmented
              library  path.  If, however, the binary was linked with -z
node-
              flib linker option, libraries in the default library  paths
are
              skipped.

       o      In  the default path /lib, and then /usr/lib.  If the binary
was
              linked with -z nodeflib linker option, this step is skipped.


 $ cat /etc/ld.so.conf
/usr/kerberos/lib
/usr/X11R6/lib
/usr/lib/qt-3.0.5/lib
/usr/local/lib

and

$ env | grep ^DT_
$ env | grep ^LD_

So, to resolve a library, ld looks in the -L values:

1. /usr/local/include
2. /usr/local/lib
3. /linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd

And then in the 'standard' places searched are

4. /usr/kerberos/lib
5. /usr/X11R6/lib
6. /usr/lib/qt-3.0.5/lib
7. /usr/local/lib
8. /lib
9. /usr/lib



Similarly, if you break apart the gcc COMPILE line and scrap the dups,
you'll have a different set of places where gcc looks for the .h files.

/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H  -DLINUX
    -I. -I/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd -I/usr/local/include
   -g -O2 -fPIC -g -O2 -c
   -Wshadow ... -Wnested-externs
    -o ntop_darwin.lo

For those, it's the -I parameters plus whatever is 'standard' on your
system, which is gcc dependent...

A big problem is that - unlike .so files, it's not real clear what libraries
ARE searched for .h files, only that there is a set.

>From this,

$ man gcc
...
       -I dir
           Add the directory dir to the list of directories to be searched
for
           header files.  Directories named by -I are searched before the
           standard system include directories.
...
           If a standard system include directory, or a directory specified
           with -isystem, is also specified with -I, it will be searched
only
           in the position requested by -I.  Also, it will not be considered
a
           system include directory.  If that directory really does contain
           system headers, there is a good chance that they will break.  For
           instance, if GCC's installation procedure edited the headers in
           /usr/include to fix bugs, -I/usr/include will cause the original,
           buggy headers to be found instead of the corrected ones.  GCC
will
           issue a warning when a system include directory is hidden in this
           way.
...

We know it's the -I directories, then /usr/include then maybe others...

With me so far?  Go back to the message...

>From one set of locations, at compile time, the size of the parameter list
for pcap_open_dead was 100 bytes.
>From the other set of locations, at link (ld) time, the library expects the
parameter list to be of size 67.

Danger, Will Robinson...


The most likely cause of this problem is when you tell ntop to look at one
location to resolve either the .h or .so and it finds the other,
'automatically' in a 'standard' location, but the two are actually from
incompatible versions.


Say you have libpcap 0.6.2 installed by the os in /usr/lib and /usr/include,
but you also install libpcap 0.7.2 in /usr/local/lib and /usr/local/include.

$ locate pcap.h
/usr/include/pcap.h
/usr/local/include/pcap.h

$ locate libpcap.so
/usr/lib/libpcap.so.0
/usr/lib/libpcap.so
/usr/lib/libpcap.so.0.6.2
/usr/lib/libpcap.so.0.6
/usr/local/lib/libpcap.so.0
/usr/local/lib/libpcap.so
/usr/local/lib/libpcap.so.0.7.2
/usr/local/lib/libpcap.so.0.7


but you ./configure .... --with-pcap-header=/usr/local/lib

@ compile, it finds the pcap.h in /usr/local/lb (0.7.2)

@ ld, it finds the libpcap.so in the 'default', /usr/lib/libpcap.so which is
actually libpcap.so.0.7.2


ntop did EXACTLY what you told it to do.  The fact that it makes no sense is
a problem, so you get an error message.


-----Burton




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Aleš
Sušnik
Sent: Tuesday, July 15, 2003 5:30 AM
To: [EMAIL PROTECTED]
Subject: RE: [Ntop] problems compiling ntop 2.2c with rrdtool 1.42


Luca,

i've tried also 2.2.3 and i get this at make time:

/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I.
-I/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd -I/usr/local/include
-I/usr/local/include -g -O2 -DLINUX -I/usr/local/include -Wshadow
-Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fPIC -g -O2 -DLINUX -I/usr/local/include -Wshadow -Wpointer-arith
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs  -fPIC -c -o
ntop_darwin.lo `test -f 'ntop_darwin.c' || echo './'`ntop_darwin.c
rm -f .libs/ntop_darwin.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -I.
-I/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd -I/usr/local/include
-I/usr/local/include -g -O2 -DLINUX -I/usr/local/include -Wshadow
-Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fPIC -g -O2 -DLINUX -I/usr/local/include -Wshadow -Wpointer-arith
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fPIC -c
ntop_darwin.c -MT ntop_darwin.lo -MF .deps/ntop_darwin.TPlo -MD -MP  -fPIC
-DPIC -o .libs/ntop_darwin.lo
mv -f .libs/ntop_darwin.lo ntop_darwin.o
(cd . && ln -s ntop_darwin.o ntop_darwin.lo)
/bin/sh ./libtool --mode=link gcc -g -O2 -DLINUX -I/usr/local/include
-Wshadow -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations
-Wnested-externs  -fPIC -g -O2 -DLINUX -I/usr/local/include -Wshadow
-Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fPIC -L/usr/local/include -L/usr/local/include -o libntop.la -rpath
/usr/local/lib -L/usr/local/include -release 2.2.3 -export-dynamic
address.lo argv.lo dataFormat.lo getopt.lo getopt1.lo globals-core.lo
hash.lo initialize.lo leaks.lo netflow.lo ntop.lo pbuf.lo plugin.lo
protocols.lo sessions.lo term.lo util.lo traffic.lo vendor.lo version.lo
ntop_darwin.lo  -lpthread -lresolv -lnsl -lz -lc -lssl -lcrypto -lgd -lpng
-lpcap -lgdbm -L/usr/local/lib -L/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd
-lmyrrd
rm -fr .libs/libntop.la .libs/libntop.* .libs/libntop-2.2.3.*
gcc -shared  address.lo argv.lo dataFormat.lo getopt.lo getopt1.lo
globals-core.lo hash.lo initialize.lo leaks.lo netflow.lo ntop.lo pbuf.lo
plugin.lo protocols.lo sessions.lo term.lo util.lo traffic.lo vendor.lo
version.lo ntop_darwin.lo  -L/usr/local/include -lpthread -lresolv -lnsl -lz
-lc -lssl -lcrypto -lgd -lpng -lpcap /usr/lib/libgdbm.so -L/usr/local/lib
-L/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/myrrd -lmyrrd  -Wl,-soname
-Wl,libntop-2.2.3.so -o .libs/libntop-2.2.3.so
/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../libpcap.a(pcap.o): In
function `pcap_open_dead':
pcap.o(.text+0x188): multiple definition of `pcap_open_dead'
util.lo:/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3/util.c:3703: first defined
here
/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../../i386-slackware-linux
/bin/ld: Warning: size of symbol `pcap_open_dead' changed from 100 to 67 in
pcap.o
collect2: ld returned 1 exit status
make[2]: *** [libntop.la] Error 1
make[2]: Leaving directory `/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/linuxadmin/ntop/ntop2.2.3/ntop-2.2.3'
make: *** [all] Error 2

A.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Luca
Deri
Sent: Tuesday, July 15, 2003 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [Ntop] problems compiling ntop 2.2c with rrdtool 1.42


Ales,
can you please give a try to ntop 2.2.x that's in CVS: it should work
with RRD. If not, please report me.

Cheers, Luca

Aleš Sušnik wrote:

>Is it possible I'm having some issues with libgd.a, tho i dunno what kind
>of?
>The only libgd.a that I have is the one in the gd-1.8.3 dir, temp. rename
>the one in /usr/local/lib dir.
>
>Ales
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aleš
>Sušnik
>Sent: Monday, July 14, 2003 10:33 PM
>To: [EMAIL PROTECTED]
>Subject: [Ntop] problems compiling ntop 2.2c with rrdtool 1.42
>
>
>I'm trying to compile ntop 2.2c with rrdtool 1.42 and at compile time i get
>the error (bellow).
>
>Using this configure:
>
>./configure --with-rrd-root=/usr/local/rrdtool-1.0.42
>--with-libpng-root=../gdchart
>0.94c/gd-1.8.3/libpng-1.2.4  --with-gdchart-root=../gdchart0.94c
>--with-zlib-root=../gdchart0.94c/zlib
>-1.1.4 --with-gd-root=../gdchart0.94c/gd-1.8.3 --enable-shared
>
>I otherwise already have a running ntop 2.2c, without rrdtools, so
otherwise
>it compiles ok...
>
>Running slackware 8.1.
>
>Any ideas anyone? I'm out of them...
>
>Thank you in advance,
>Ales
>
>
>
><= cut here =>
>
>/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I.
>-I/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/zlib-1.1.4 -I../gdchart0.94c
>-I../gdchart0.94c/gd-1.8.3 -I../gdchart0.94c/gd-1.8.3/libpng-1.2.4
>-I/usr/local/rrdtool-1.0.42/include    -DLINUX -g -O2 -Wshadow
>-Wpointer-arith -Wmissing-prototypes -Wmissing-declarations
-Wnested-externs
>-fPIC -DLINUX -g -O2 -Wshadow -Wpointer-arith -Wmissing-prototypes
>-Wmissing-declarations -Wnested-externs  -fPIC -c -o xmldump.lo `test -f
>'xmldump.c' || echo './'`xmldump.c
>rm -f .libs/xmldump.lo
>gcc -DHAVE_CONFIG_H -I. -I. -I. -I.
>-I/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/zlib-1.1.4 -I../gdchart0.94c
>-I../gdchart0.94c/gd-1.8.3 -I../gdchart0.94c/gd-1.8.3/libpng-1.2.4
>-I/usr/local/rrdtool-1.0.42/include -DLINUX -g -O2 -Wshadow -Wpointer-arith
>-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fPIC -DLINUX
>-g -O2 -Wshadow -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations
>-Wnested-externs -fPIC -c xmldump.c -MT xmldump.lo -MF .deps/xmldump.TPlo
>-MD -MP  -fPIC -DPIC -o .libs/xmldump.lo
>xmldump.c:1863: warning: no previous prototype for `dumpXML'
>mv -f .libs/xmldump.lo xmldump.o
>(cd . && ln -s xmldump.o xmldump.lo)
>/bin/sh ./libtool --mode=link gcc -DLINUX -g -O2 -Wshadow -Wpointer-arith
>-Wmissing-prototypes -Wmissing-declarations -Wnested-externs  -fPIC -DLINUX
>-g -O2 -Wshadow -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations
>-Wnested-externs  -fPIC   -o libntopreport.la -rpath /usr/local/lib
>-release 2.2c -export-dynamic  emitter.lo globals-report.lo graph.lo
http.lo
>report.lo reportUtils.lo webInterface.lo xmldump.lo  -lpthread -lresolv
>-lnsl -lm -lssl -lcrypto -lpcap -lgdbm -ldl -lcrypt -lc
>-L/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/zlib-1.1.4 -lz
>-L../gdchart0.94c -lgdchart -L../gdchart0.94c/gd-1.8.3 -lgd
>-L../gdchart0.94c/gd-1.8.3/libpng-1.2.4 -lpng
>-L/usr/local/rrdtool-1.0.42/lib -lrrd
>rm -fr .libs/libntopreport.la .libs/libntopreport.*
>.libs/libntopreport-2.2c.*
>gcc -shared  emitter.lo globals-report.lo graph.lo http.lo report.lo
>reportUtils.lo webInterface.lo xmldump.lo -Wl,--whole-archive
>/usr/local/rrdtool-1.0.42/lib/librrd.a -Wl,--no-whole-archive  -lpthread
>-lresolv -lnsl -lm -lssl -lcrypto -lpcap /usr/lib/libgdbm.so -ldl -lcrypt
>-lc -L/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/zlib-1.1.4 -lz
>-L/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c -lgdchart
>-L/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3 -lgd
>-L/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3/libpng-1.2.4 -lpng
>-L/usr/local/rrdtool-1.0.42/lib /usr/local/rrdtool-1.0.42/lib/librrd.a
>-Wl,-soname -Wl,libntopreport-2.2c.so -o .libs/libntopreport-2.2c.so
>/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3/libgd.a(gd_png.o): In
>function `gdImagePng':
>gd_png.o(.text+0x8c8): multiple definition of `gdImagePng'
>/usr/local/rrdtool-1.0.42/lib/librrd.a(gdpng.o):/linuxadmin/rrdtool/rrdtool
-
>1.0.42/src/gdpng.c:18: first defined here
>/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../../i386-slackware-linu
x
>/bin/ld: Warning: size of symbol `gdImagePng' changed from 419 to 55 in
>gd_png.o
>/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3/libgd.a(gd_io.o): In
>function `gdPutWord':
>gd_io.o(.text+0x5c): multiple definition of `gdPutWord'
>/usr/local/rrdtool-1.0.42/lib/librrd.a(gd.o):/linuxadmin/rrdtool/rrdtool-1.
0
>.42/gd1.3/gd.c:1737: first defined here
>/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../../i386-slackware-linu
x
>/bin/ld: Warning: size of symbol `gdPutWord' changed from 58 to 40 in
>gd_io.o
>/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3/libgd.a(gd_io.o): In
>function `gdGetByte':
>gd_io.o(.text+0xe0): multiple definition of `gdGetByte'
>/usr/local/rrdtool-1.0.42/lib/librrd.a(gd.o):/linuxadmin/rrdtool/rrdtool-1.
0
>.42/gd1.3/gd.c:1743: first defined here
>/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../../i386-slackware-linu
x
>/bin/ld: Warning: size of symbol `gdGetByte' changed from 60 to 39 in
>gd_io.o
>/linuxadmin/ntop/ntop-2.2c/ntop/gdchart0.94c/gd-1.8.3/libgd.a(gd_io.o): In
>function `gdGetWord':
>gd_io.o(.text+0x108): multiple definition of `gdGetWord'
>/usr/local/rrdtool-1.0.42/lib/librrd.a(gd.o):/linuxadmin/rrdtool/rrdtool-1.
0
>.42/gd1.3/gd.c:1721: first defined here
>/usr/lib/gcc-lib/i386-slackware-linux/3.0.4/../../../../i386-slackware-linu
x
>/bin/ld: Warning: size of symbol `gdGetWord' changed from 88 to 66 in
>gd_io.o
>collect2: ld returned 1 exit status
>make[2]: *** [libntopreport.la] Error 1
>make[2]: Leaving directory `/linuxadmin/ntop/ntop-2.2c/ntop/ntop'
>make[1]: *** [all-recursive] Error 1
>make[1]: Leaving directory `/linuxadmin/ntop/ntop-2.2c/ntop/ntop'
>make: *** [all] Error 2
>[EMAIL PROTECTED]:/linuxadmin/ntop/ntop-2.2c/ntop/ntop#
>
><= cut here =>
>
>
>_______________________________________________
>Ntop mailing list
>[EMAIL PROTECTED]
>http://listgateway.unipi.it/mailman/listinfo/ntop
>
>
>_______________________________________________
>Ntop mailing list
>[EMAIL PROTECTED]
>http://listgateway.unipi.it/mailman/listinfo/ntop
>
>


--
Luca Deri <[EMAIL PROTECTED]>   http://luca.ntop.org/
Hacker: someone who loves to program and enjoys being
clever about it - Richard Stallman


_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop


_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop


_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

Reply via email to