I am attempting to compile iftop 0.17 on an HP Integrity (i.e., IA64)
server under HP-UX 11.23. I am using the following GNU build
environment:
ar : GNU ar 2.17
as : GNU assembler 2.17
autoconf : autoconf (GNU Autoconf) 2.61
automake : automake (GNU automake) 1.10
bison : bison (GNU Bison) 2.3
flex : flex 2.5.33
gawk : GNU Awk 3.1.5
gcc : gcc (GCC) 4.1.2
make : GNU Make 3.81
nm : GNU nm 2.17
sed : GNU sed version 4.1.5
shtool : GNU shtool 2.0.7 (19-May-2007)
And, the following configure command:
CFLAGS='-lpthread' CPPFLAGS='-I /usr/local/include/ncurses' CC=gcc
./configure
The CFLAGS parameter is required to overcome an error in configure, to
correctly identify the threads capability in HP-UX.
The CPPFLAGS parameter is required to overcome an error in make, to
correctly located the ncurses library.
The command results in the following make error:
source='addrs_dlpi.c' object='addrs_dlpi.o' libtool=no \
depfile='.deps/addrs_dlpi.Po' tmpdepfile='.deps/addrs_dlpi.TPo'
\
depmode=gcc3 /bin/sh ./config/depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I. -I /usr/local/include/ncurses
-lpthread -c `test -f 'addrs_dlpi.c' || echo './'`a
ddrs_dlpi.c
addrs_dlpi.c:24:24: error: sys/sockio.h: No such file or directory
addrs_dlpi.c:53: warning: 'struct in_addr' declared inside parameter
list
addrs_dlpi.c:53: warning: its scope is only this definition or
declaration, which is probably not what you want
addrs_dlpi.c: In function 'get_addrs_dlpi':
addrs_dlpi.c:184: error: dereferencing pointer to incomplete type
addrs_dlpi.c:190: error: dereferencing pointer to incomplete type
addrs_dlpi.c:190: error: invalid application of 'sizeof' to incomplete
type 'struct in_addr'
make[2]: *** [addrs_dlpi.o] Error 1
make[2]: Leaving directory `/usr/local/install/iftop-0.17'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/install/iftop-0.17'
make: *** [all] Error 2
#
The first error, regarding the 'sys/sockio.h' header can be overcome by
removing the include from the addrs_dlpi.c source, since, according to
HP, the socket ioctl definitions are defined in the
/usr/include/sys/ioctl.h' header file, which is included in the
addrs_dlpi.c source. However, removing the 'sys/sockio.h' reference
only resolves the first error; the other errors, regarding the pointer
dereferencing and the type application remain.
The section of addrs_dlpi.c code apparently generating the errors looks
like:
178 #ifdef SIOCGIFADDR
179
180 fd = socket(PF_INET, SOCK_DGRAM, 0); /* any sort of IP socket
will do */
181
182 strncpy(ifr.ifr_name, interface, IFNAMSIZ);
183
184 (*(struct sockaddr_in *) &ifr.ifr_addr).sin_family = AF_INET;
185
186 if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) {
187 fprintf(stderr, "Error getting IP address for interface:
%s\n", "ge0");
188 perror("ioctl(SIOCGIFADDR)");
189 } else {
190 memcpy(if_ip_addr, &((*(struct sockaddr_in *)
&ifr.ifr_addr).sin_addr), sizeof(struct in_addr));
191 got_ip_addr = 2;
192 }
193 #else
194 fprintf(stderr, "Cannot obtain IP address on this
platform\n");
195 #endif
Although the warnings appear to reference the structure definition
generating the errors:
51
52 int
53 get_addrs_dlpi(char *interface, char if_hw_addr[], struct
in_addr *if_ip_addr)
54 {
55 int got_hw_addr = 0;
56 int got_ip_addr = 0;
57
Any ideas as to where to go next? Any help would be appreciated.
Thanks.
Jay Franz
jay.franz(a)ssa.gov