Nmap Development mailing list archives

Error compiling nmap-5.59BETA1 on Solaris (with solution)


From: Richard <rleeden () gmail com>
Date: Fri, 1 Jul 2011 18:09:29 +0100

Hi,

When compiling nmap-5.59BETA1 on my Sparc Solaris 9 I get the following two
errors:

1)
ncat_listen.c: In function `get_conn_count':
ncat_listen.c:155: error: `INT_MAX' undeclared (first use in this function)
ncat_listen.c:155: error: (Each undeclared identifier is reported only once
ncat_listen.c:155: error: for each function it appears in.)
gmake[1]: *** [ncat_listen.o] Error 1
gmake[1]: Leaving directory `/xfer/nmap-5.59BETA1/ncat'
gmake: *** [ncat_build] Error 2

2)
netutil.cc: In function `int add_ancillary(msghdr*, size_t, int, int, const
void*, size_t)':
netutil.cc:3485: error: `CMSG_ALIGN' was not declared in this scope
netutil.cc:3489: error: `CMSG_ALIGN' was not declared in this scope
netutil.cc:3491: error: `CMSG_LEN' was not declared in this scope
netutil.cc:3491: warning: unused variable 'CMSG_LEN'
netutil.cc: In function `int send_ipv6_ip(const unsigned char*, size_t)':
netutil.cc:3525: error: `CMSG_ALIGN' was not declared in this scope
netutil.cc:3514: warning: unused variable 'tclass'
gmake[1]: *** [netutil.o] Error 1
gmake[1]: Leaving directory `/xfer/nmap-5.59BETA1/libnetutil'
gmake: *** [netutil_build] Error 2


The following two patches fixed this for me:

1)
--- ncat_listen.c_orig  2011-07-01 18:05:54.841902000 +0100
+++ ncat_listen.c       2011-07-01 17:40:01.568003000 +0100
@@ -96,6 +96,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <limits.h>
 #ifndef WIN32
 #include <unistd.h>
 #include <sys/socket.h>

2)
 --- netutil.h_orig      2011-07-01 18:02:25.660812000 +0100
+++ netutil.h   2011-07-01 17:53:37.419224000 +0100
@@ -114,6 +114,24 @@
 #define IPPROTO_SCTP 132
 #endif

+/* For systems without CMSG_ALIGN, CMSG_SPACE and CMSG_LEN such as Solaris.
+   (From
http://mailman.videolan.org/pipermail/vlc-devel/2006-May/024402.html) */
+#ifndef CMSG_ALIGN
+#ifdef __sun__
+#define CMSG_ALIGN _CMSG_DATA_ALIGN
+#else
+#define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1))
+#endif
+#endif
+
+#ifndef CMSG_SPACE
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct
cmsghdr))+CMSG_ALIGN(len))
+#endif
+
+#ifndef CMSG_LEN
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+(len))
+#endif
+
 /* Container used for information common to IPv4 and IPv6 headers, used by
    ip_get_data. */
 struct abstract_ip_hdr {


Regards

Richard van der Leeden
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: