[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#671064: nmap: FTBFS[kfreebsd]: error: 'CLOCK_MONOTONIC' undeclared



tags 671064 + patch
thanks

On 01/05/12 17:23, Christoph Egger wrote:
> gcc -O2 -Wall -D_GNU_SOURCE -O2 -O2 -Wall -D_GNU_SOURCE -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c ./pcap-bpf.c
> ./pcap-bpf.c: In function 'pcap_next_zbuf':
> ./pcap-bpf.c:334:3: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
> ./pcap-bpf.c:334:24: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
> ./pcap-bpf.c:334:24: note: each undeclared identifier is reported only once for each function it appears in
> make[2]: *** [pcap-bpf.o] Error 1

Argh.  After figuring out what was wrong here, I then realised this was
already fixed in the libpcap0.8 package, just not in this embedded copy
of the library:

--- a/pcap-bpf.c
+++ b/pcap-bpf.c
@@ -31,8 +31,8 @@ static const char rcsid[] _U_ =
 #ifdef HAVE_ZEROCOPY_BPF
 #include <sys/mman.h>
 #endif
-#include <sys/time.h>
 #include <sys/socket.h>
+#include <time.h>
 /*
  * <net/bpf.h> defines ioctls, but doesn't include <sys/ioccom.h>.
  *

With that applied, for nping and nmap binaries to then link with the
statically-compiled embedded libpcap, they must also link with -lrt,
which the attached patch takes care of.

Builds successfully on kfreebsd-i386 after that, and appears to work.


While here, I also saw what looked like Microsoft .exe redistributables
in the source tarball / Git repository?

Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
--- nmap-5.51.6.orig/nping/configure.ac	2011-10-17 10:07:06.000000000 +0100
+++ nmap-5.51.6/nping/configure.ac	2012-05-01 20:01:47.944942908 +0100
@@ -121,6 +121,8 @@
 
 # libpcap can require libnl
 AC_SEARCH_LIBS(nl_handle_alloc, nl)
+# and librt
+AC_SEARCH_LIBS(clock_gettime, rt)
 
 # We test whether they specified openssl desires explicitly
 use_openssl="yes"
--- nmap-5.51.6.orig/configure.ac	2010-09-29 17:09:26.000000000 +0100
+++ nmap-5.51.6/configure.ac	2012-05-01 20:06:08.011994753 +0100
@@ -578,6 +578,8 @@
 
 # libpcap can require libnl
 AC_SEARCH_LIBS(nl_handle_alloc, nl)
+# and librt
+AC_SEARCH_LIBS(clock_gettime, rt)
 
 # They don't want lua
 if test "$no_lua" = "yes"; then

Reply to: