This is Shaun
The oft-drunken ramblings of a random geek in Memphis. /* Crazy and just plain stupid. */

31337


Worth Reading...

Steve's Page
Peter's Page

Frigax

EFF
Fark
TNDF
Packing
Freenet
Politech
Recipe Barn
All of 'em
GlockTalk
Cryptome
The Daily WTF?
Where's George

Me Elsewhere...

/.: ShaunC
Fark: Frigax
NANAS: Canned Ham

Beer
...cheers!

309494

02/14/2009 00:32 1621 stdint.h: No such file or directory
I've been using a great utility called darkstat to monitor my bandwidth usage on my home firewall. darkstat keeps track of every host that the monitored machine has contacted or been contacted from, inbound or outbound. It speaks TCP, UDP, and ICMP. For each host, it will tell you the number of packets and bytes exchanged in and out, and on which ports. darkstat also draws some nice graphs of your network traffic over the last minute, hour, day, and month; the graphs can be animated in realtime. It's a lovely way to track your bandwidth.

I had no problem getting darkstat up and running on my FreeBSD 6.4 firewall machine at home. I thought it would be interesting to install it here, on my dedicated server which runs FreeBSD 4.11, but I ran into some trouble:

[root@shaunc darkstat]# make
===> Building for darkstat-3.0.712
cc -pipe -O -pipe -c acct.c -o acct.o
In file included from daylog.h:7,
from acct.c:22:
graph_db.h:7: stdint.h: No such file or directory
*** Error code 1

Stop in /usr/ports/net-mgmt/darkstat/work/darkstat-3.0.712.
*** Error code 1

Oops. It seems that my gcc is too outdated to have stdint.h. Upgrading the compiler is a huge proposition: will it continue to properly build the kernel? Are newer versions of gcc backwards-compatible with my machine, or my OS? The operational ability of everything on a unix machine is dependent upon having a working compiler. It's the one thing that you don't want to touch unless you're absolutely confident that your changes won't cause any problems.

After several hours of searching, I found a viable workaround. Apparently, on FreeBSD 4.x, inttypes.h is forward-compatible to later gcc's stdint.h. All that's required is to create a link from inttypes.h that masquerades as the missing stdint.h:

[root@shaunc darkstat]# ln -s /usr/include/inttypes.h /usr/include/stdint.h
[root@shaunc darkstat]# make
===> Building for darkstat-3.0.712
cc -pipe -O -pipe -c acct.c -o acct.o
cc -pipe -O -pipe -c cap.c -o cap.o
cc -pipe -O -pipe -c conv.c -o conv.o
cc -pipe -O -pipe -c darkstat.c -o darkstat.o
cc -pipe -O -pipe -c daylog.c -o daylog.o
cc -pipe -O -pipe -c db.c -o db.o
cc -pipe -O -pipe -c decode.c -o decode.o
cc -pipe -O -pipe -c dns.c -o dns.o
cc -pipe -O -pipe -c err.c -o err.o
cc -pipe -O -pipe -c graph_db.c -o graph_db.o
cc -pipe -O -pipe -c hosts_db.c -o hosts_db.o
cc -pipe -O -pipe -c hosts_sort.c -o hosts_sort.o
cc -pipe -O -pipe static/c-ify.c -o c-ify
./c-ify style_css stylecss.h
./c-ify graph_js graphjs.h
cc -pipe -O -pipe -c http.c -o http.o
cc -pipe -O -pipe -c localip.c -o localip.o
cc -pipe -O -pipe -c ncache.c -o ncache.o
cc -pipe -O -pipe -c pidfile.c -o pidfile.o
cc -pipe -O -pipe -c str.c -o str.o
Linking darkstat
cc -pipe -O -pipe acct.o cap.o conv.o darkstat.o daylog.o db.o decode.o dns.o err.o graph_db.o hosts_db.o hosts_sort.o http.o localip.o ncache.o pidfile.o str.o -lpcap -lz -o darkstat

And there it is, darkstat is compiled.

With sincere thanks to Emil Mikulic.



 


Contents © 1999-2010 - Anything I didn't steal belongs to me | Contact Shaun | 55c3fb27a9d263e34692df876a3483fd