Loading...
 
Skip to main content

MtrOnOSX

mtr is a nice network diagnostic tool a la traceroute (just on steroids, with tons of more useful options). It's available with a curses and a GTK interface.

The build seems to need automake and autoconf (just use Fink).

With the original mtr 0.69 sources, the build will break with an error like the following:
 source='dns.c' object='dns.o' libtool=no \
 depfile='.deps/dns.Po' tmpdepfile='.deps/dns.TPo' \
 depmode=gcc3 /bin/sh ./depcomp \
 gcc -DHAVE_CONFIG_H -I. -I. -I.     -O3 -mcpu=750 -Wall -c `test -f 'dns.c' || echo './'`dns.c
 dns.c:238: error: `PACKETSZ' undeclared here (not in a function)
 dns.c: In function `dorequest':
 dns.c:861: error: `PACKETSZ' undeclared (first use in this function)
 dns.c:861: error: (Each undeclared identifier is reported only once
 dns.c:861: error: for each function it appears in.)
 dns.c:863: error: `QUERY' undeclared (first use in this function)
 dns.c:863: error: `C_IN' undeclared (first use in this function)
 dns.c:861: warning: unused variable `buf'
 dns.c: In function `resendrequest':
 dns.c:877: error: `T_A' undeclared (first use in this function)
 dns.c:884: error: `T_PTR' undeclared (first use in this function)
 dns.c: In function `parserespacket':
 dns.c:991: error: `NOERROR' undeclared (first use in this function)
 dns.c:1026: error: `MAXDNAME' undeclared (first use in this function)
 dns.c:1051: error: `C_IN' undeclared (first use in this function)
 dns.c:1058: error: `T_PTR' undeclared (first use in this function)
 dns.c:1118: error: `T_CNAME' undeclared (first use in this function)
 dns.c:1125: error: `T_A' undeclared (first use in this function)
 dns.c:1201: error: `NXDOMAIN' undeclared (first use in this function)
 dns.c: In function `dns_ack':
 dns.c:1221: error: `PACKETSZ' undeclared (first use in this function)
 dns.c: In function `dns_events':
 dns.c:1282: error: `T_PTR' undeclared (first use in this function)
 dns.c: In function `dns_lookup2':
 dns.c:1343: error: `T_PTR' undeclared (first use in this function)
 dns.c: At top level:
 dns.c:238: error: storage size of `resrecvbuf' isn't known 
 make[2]: *** [dns.o] Error 1+-

The solution can be found in this posting (cache) on the NetBSD tech-pkg mailinglist, or just apply the following patch:
 --- dns.c.orig  Sat Jan 22 19:15:23 2005
 +++ dns.c       Sat Jan 22 19:16:05 2005
 @@ -32,9 +32,9 @@
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
 -#include <arpa/nameser.h> 
 +#include <arpa/nameser8_compat.h> 
  #include <netdb.h>
 -#include <resolv.h> 
 +#include <resolv8_compat.h> 
  #include <unistd.h>
  #include <fcntl.h>
  #include <ctype.h>

(this seems to be a common problem with MacOS X ports, sometimes adding -DBIND_8_COMPAT to the CFLAGS might help, too)

With this change, mtr builds without any further problems:
 > ./configure --without-gtk --with-gtk-prefix=/neverthere --prefix=/usr/local 
 > make
 > sudo make install