Thanks for the breakdown, this will help me with troubleshooting issues for other programs as well. I'm not sure what you mean by copy and paste the source file from the log into conftest.c
I'm not sure what the source file within the log file is. If it helps my environment is LFS version 3.0 As an experiment I compiled the same source on an old redhat box and it compiled fine. I then looked through the log for the -lpng section and there was no reference to -lz or -lm there either. I'm sure the problem is finding these libraries, but I don't understand why it can't locate them. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Burton M. Strauss III Sent: Monday, December 01, 2003 3:30 PM To: [EMAIL PROTECTED] Subject: RE: [Ntop] configure issues Ok, let's learn about what happens behind the smoke & mirrors. gcc is a program that turns the c code into binary files. These files (xxxx.o is their usual name) can't be executed as they haven't been through the next process... ld is a program that turns lots of binary files into an executable file (still binary, but this one can be run by users). ld does things like figure out which chunk of code that call to the pow() function really means. How it resolves those is to look in the shared object files (.so files) that you told it about via the -l parameters in the ld line. Where it gets confusing is that gcc invokes ld for you, under the covers as it were, so you often don't see it. It's also confusing because references can be to files you've got no clue about - hidden in references you actually did make. But that's where the undefined reference comes from. So... The actual code for gd (the graphics creator) which ntop calls is in a .so file named libgd.so. That chunk of code references another library to build png files, named libpng.so. That chunk of code uses standard math functions like pow(). So while you won't see a reference in ntop to pow(), it's required. Break up the gcc invocation and you'll see this: gcc -o conftest -g -O2 -I/usr/local/include -Wshadow -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wn ested-externs -fPIC -DLINUX -I/usr/local/include -L/usr/local/lib conftest.c -lpng -lgd -lgdbm -lpcap -lpcap -lgdbm -lgd -lpng Where the -o parameter tells the name of the output file The -g -O2 -Ws are various compiler tuning parameters -I parameters tell gcc where to look for .h files (beyond a set of 'standard' locations that it always checks) -L parameters tell gcc where to look for .so files (beyond a different set of 'standard' locations) the -l parameters are libs to include always, minus the lib and .so (so -lgdbm means libgdbm.so) Notice that there's no math type library listed there. It's oftne libmath.so or libm.so Notice that there's no zlib library listed there. It's usually libz.so. If you manually run gcc (cut & paste the source file from the log into conftest.c): gcc -o conftest -g -O2 -I/usr/local/include -Wshadow -Wpointer-arith -Wmissing-prot otypes -Wmissing-declarations -Wnested-externs -fPIC -DLINUX -I/usr/local/ include -L/usr/local/lib conftest.c -lpng -lgd -lgdbm -lpcap -lpcap -lgdbm -lgd -lpng -lz -lm it will probably work. Then it's up to you to tell ntop how to find these libraries. -----Burton PS: In the future, give us details about your environment. Since you didn't, I'm pushing it back on you. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Frank Clatterbaugh Sent: Monday, December 01, 2003 2:46 PM To: [EMAIL PROTECTED] Subject: RE: [Ntop] configure issues Ok, thanks Burton. Below are details from the log file where I think the problem is at. I still have no idea what it's squawking about. configure:9370: checking for main in -lpng configure:9395: gcc -o conftest -g -O2 -I/usr/local/include -Wshadow -Wpointer-arith -Wmissing-prot otypes -Wmissing-declarations -Wnested-externs -fPIC -DLINUX -I/usr/local/ include -L/usr/local/ lib conftest.c -lpng -lgd -lgdbm -lpcap -lpcap -lgdbm -lgd -lpng >&5 cc1: warning: changing search order for system directory "/usr/local/include" cc1: warning: as it has already been specified as a non-system directory /usr/local/lib/libpng.so: undefined reference to `deflate' /usr/local/lib/libpng.so: undefined reference to `inflate' /usr/local/lib/libpng.so: undefined reference to `inflateInit_' /usr/local/lib/libpng.so: undefined reference to `crc32' /usr/local/lib/libpng.so: undefined reference to `pow' /usr/local/lib/libpng.so: undefined reference to `deflateInit2_' /usr/local/lib/libpng.so: undefined reference to `inflateReset' /usr/local/lib/libpng.so: undefined reference to `deflateReset' /usr/local/lib/libpng.so: undefined reference to `inflateEnd' /usr/local/lib/libpng.so: undefined reference to `deflateEnd' collect2: ld returned 1 exit status configure:9398: $? = 1 configure: failed program was: | #line 9377 "configure" | /* confdefs.h. */ | | #define PACKAGE_NAME "ntop" | #define PACKAGE_TARNAME "ntop" | #define PACKAGE_VERSION "2.2.97" | #define PACKAGE_STRING "ntop 2.2.97" | #define PACKAGE_BUGREPORT "" | #define PACKAGE "ntop" | #define VERSION "2.2.97" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_LONG_DOUBLE 1 | #define CFG_LITTLE_ENDIAN 1 | #define HAVE_PCAP_H 1 | #define HAVE_LIBPCAP 1 | #define HAVE_PCAP_OPEN_DEAD 1 | #define HAVE_GDBM_H 1 | #define HAVE_LIBGDBM 1 | #define HAVE_GD_H 1 | #define HAVE_LIBGD 1 | #define HAVE_PNG_H 1 | /* end confdefs.h. */ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Burton M. Strauss III Sent: Monday, December 01, 2003 2:15 PM To: [EMAIL PROTECTED] Subject: RE: [Ntop] configure issues Usual answer - look at config.log and see the actual error message, then fix the problem. -----Burton -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Frank Clatterbaugh Sent: Monday, December 01, 2003 1:29 PM To: [EMAIL PROTECTED] Subject: [Ntop] configure issues I have just downloaded the most recent version from CVS and am having difficulty compiling the source. I looked through the back traffic and couldn't find the answer to this question, so be kind Burton. When I run configure I get the following errors: checking for libpng... checking png.h usability... yes checking png.h presence... yes checking for png.h... yes checking for main in -lpng... no ******************************************************************* * * ERROR: libpng header or library routines are missing * (yes means it was found, no means it was not found) * * png.h...yes * png_read_info() in -lpng... * *>>> No way to proceed. * *??? Install libpng (and/or libpng-devel), check www.libpng.org *??? and Rerun ./configure * ******************************************************************* I tried reinstalling zlib and libpng but it still gave these errors. I tried the -with directives to point to /usr/local/lib and /usr/local/include and still got these errors. Any ideas ? _______________________________________________ Ntop mailing list [EMAIL PROTECTED] http://listgateway.unipi.it/mailman/listinfo/ntop _______________________________________________ Ntop mailing list [EMAIL PROTECTED] http://listgateway.unipi.it/mailman/listinfo/ntop
