Several weeks ago I posted about a problem configuring iftop to compile on NetBSD-1.6.1; specifically, the configure script would die when it came to checking for Posix thread support. I've now updated that machine to NetBSD-1.6.2 and the configure script runs to completion without complaint (after passing it LDFLAGS=-L/usr/pkg/lib/ and CPPFLAGS=-I/usr/pkg/include to point it to the Posix thread support). Unfortunately, it fails during the compile:
gcc -g -O2 -L/usr/pkg/lib/ -o iftop addr_hash.o edline.o hash.o iftop.o ns_hash.o options.o resolver.o screenfilter.o serv_hash.o sorted_list.o threadprof.o ui.o util.o addrs_ioctl.o addrs_dlpi.o dlcommon.o stringmap.o cfgfile.o vector.o -lpcap -lm -lncurses -lpthread ui.o: In function `draw_bar_scale': /tmp/iftop-0.16/ui.c:269: undefined reference to `_acs_char' /tmp/iftop-0.16/ui.c:281: undefined reference to `_acs_char' ui.o: In function `ui_loop': /tmp/iftop-0.16/ui.c:1055: undefined reference to `__error' /tmp/iftop-0.16/ui.c:1057: undefined reference to `__error'
Any ideas where to go from here?
On Tue, Jun 22, 2004 at 05:21:14PM -0500, John Thompson wrote:
Several weeks ago I posted about a problem configuring iftop to compile on NetBSD-1.6.1; specifically, the configure script would die when it came to checking for Posix thread support. I've now updated that machine to NetBSD-1.6.2 and the configure script runs to completion without complaint (after passing it LDFLAGS=-L/usr/pkg/lib/ and CPPFLAGS=-I/usr/pkg/include to point it to the Posix thread support). Unfortunately, it fails during the compile:
this looks like two separate issues:
gcc -g -O2 -L/usr/pkg/lib/ -o iftop addr_hash.o edline.o hash.o iftop.o ns_hash.o options.o resolver.o screenfilter.o serv_hash.o sorted_list.o threadprof.o ui.o util.o addrs_ioctl.o addrs_dlpi.o dlcommon.o stringmap.o cfgfile.o vector.o -lpcap -lm -lncurses -lpthread ui.o: In function `draw_bar_scale': /tmp/iftop-0.16/ui.c:269: undefined reference to `_acs_char' /tmp/iftop-0.16/ui.c:281: undefined reference to `_acs_char'
This is a curses thing (referenced through mvaddch, which is presumably a macro); it really should Just Work.
Ah. Does NetBSD have an old-style curses as well as ncurses? If so, is it possible that the old curses header file is that being included as <curses.h>?
ui.o: In function `ui_loop': /tmp/iftop-0.16/ui.c:1055: undefined reference to `__error'
that line reads,
errno = 0;
which is certainly OK! I'm guessing that whatever NetBSD's C library does to turn errno into thread-local data is breaking here (perhaps because of a library which the configure script hasn't realised is needed to build with pthreads support). That said, the NetBSD man pages on the netbsd site don't mention another library being needed, for the CURRENT release anyway. They don't mention anything at all under pthreads for 1.6.2.
Any ideas where to go from here?
No, frankly. If you can email me privately with login details for a machine with that release of the OS on it, I'll see if I can get the thing to build. (Obviously you'll need to test it yourself....)
On Wed, Jun 23, 2004 at 11:48:23AM +0100, Chris Lightfoot wrote:
On Tue, Jun 22, 2004 at 05:21:14PM -0500, John Thompson wrote:
Several weeks ago I posted about a problem configuring iftop to compile on NetBSD-1.6.1; specifically, the configure script would die when it came to checking for Posix thread support. I've now updated that machine to NetBSD-1.6.2 and the configure script runs to completion without complaint (after passing it LDFLAGS=-L/usr/pkg/lib/ and CPPFLAGS=-I/usr/pkg/include to point it to the Posix thread support). Unfortunately, it fails during the compile:
this looks like two separate issues:
gcc -g -O2 -L/usr/pkg/lib/ -o iftop addr_hash.o edline.o hash.o iftop.o ns_hash.o options.o resolver.o screenfilter.o serv_hash.o sorted_list.o threadprof.o ui.o util.o addrs_ioctl.o addrs_dlpi.o dlcommon.o stringmap.o cfgfile.o vector.o -lpcap -lm -lncurses -lpthread ui.o: In function `draw_bar_scale': /tmp/iftop-0.16/ui.c:269: undefined reference to `_acs_char' /tmp/iftop-0.16/ui.c:281: undefined reference to `_acs_char'
This is a curses thing (referenced through mvaddch, which is presumably a macro); it really should Just Work.
Ah. Does NetBSD have an old-style curses as well as ncurses? If so, is it possible that the old curses header file is that being included as <curses.h>?
-- this turns out to be the problem here. If #include <curses.h> in ui.c is changed to, #include <ncurses.h> this works.
ui.o: In function `ui_loop': /tmp/iftop-0.16/ui.c:1055: undefined reference to `__error'
that line reads,
errno = 0;
This one is much uglier. On that particular machine, /usr/pkg/include/errno.h defines,
extern int *__error(); #define errno (*__error())
which is a fairly standard way to make the errno interface threads-compatible. However, the POSIX threads library on that machine doesn't actually export the __error symbol. It does export __errno, which references on the web suggest has the same function. Manually forcing iftop to use __errno result in a successful compile, but the program segfaults on startup, which it obviously shouldn't. So this guess at a solution is no good.
Unfortunately I can't find any libraries in /usr/pkg/lib on that machine which define __error. So I don't know what to do about this one. Any thoughts from other NetBSD users?
(BTW-- it looks like there's an iftop port in NetBSD, but perhaps this is only for more recent versions of the whole operating system.)
On Sat, 26 Jun 2004 13:01:55 +0100 Chris Lightfoot chris@ex-parrot.com wrote:
(BTW-- it looks like there's an iftop port in NetBSD, but perhaps this is only for more recent versions of the whole operating system.)
Thanks for trying. I just installed the binary port of iftop-1.6 on that machine and it seems to be working, so I'm happy....