ports/172358: [PATCH] security/nmap: Fix build with clang.

arrowdodger 6yearold at gmail.com
Fri Oct 5 14:00:15 UTC 2012


>Number:         172358
>Category:       ports
>Synopsis:       [PATCH] security/nmap: Fix build with clang.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 05 14:00:14 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     arrowdodger
>Release:        
>Organization:
>Environment:
>Description:
This patch fixes build with clang and some buildsystem mess, which wasn't allowing me to build nmap with -stdlib=libc++.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN /usr/ports/security/nmap/Makefile ./Makefile
--- /usr/ports/security/nmap/Makefile	2012-10-05 17:48:36.428550058 +0400
+++ ./Makefile	2012-10-05 17:46:53.337549058 +0400
@@ -33,7 +33,7 @@
 CONFIGURE_ENV=	LUA_INCDIR="${LUA_INCDIR}" LUA_LIBDIR="${LUA_LIBDIR}"
 
 # fix for gcc from ports
-.if ${CC} != "cc"
+.if ${CC} != "cc" && ${CC} !="clang"
 GCCLIBDIR_CMDS=	${CC} -print-file-name=libstdc++.so | ${SED} -e 's/libstdc++.so//'
 CONFIGURE_ARGS+=LDFLAGS="-L$$(${GCCLIBDIR_CMDS})"
 NDCC=	true
diff -ruN /usr/ports/security/nmap/files/patch-Makefile-cxxflags-fix ./files/patch-Makefile-cxxflags-fix
--- /usr/ports/security/nmap/files/patch-Makefile-cxxflags-fix	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-Makefile-cxxflags-fix	2012-10-05 11:07:04.000000000 +0400
@@ -0,0 +1,11 @@
+--- Makefile.in_	2012-10-05 10:17:36.037550752 +0400
++++ Makefile.in	2012-10-05 10:17:08.205548992 +0400
+@@ -46,7 +46,7 @@
+ # DEFS += -DMTRACE=1
+ CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT)
+ CPPFLAGS = @CPPFLAGS@ $(DEFS)
+-export CFLAGS = $(CXXFLAGS)
++export CFLAGS = @CFLAGS@
+ # CFLAGS = $(DEFS) $(INCLS)
+ STATIC =
+ LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
diff -ruN /usr/ports/security/nmap/files/patch-clang-fixes ./files/patch-clang-fixes
--- /usr/ports/security/nmap/files/patch-clang-fixes	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-clang-fixes	2012-10-05 17:45:06.143551658 +0400
@@ -0,0 +1,32 @@
+--- scan_engine.cc_	2012-10-05 11:13:12.003554110 +0400
++++ scan_engine.cc	2012-10-05 11:14:37.463551910 +0400
+@@ -2904,7 +2904,7 @@
+   }
+   if (o.spoofsource && !bind_failed) {
+     o.SourceSockAddr(&ss, &sslen);
+-    if (bind(sd, (struct sockaddr*)&ss, sslen) != 0) {
++    if (::bind(sd, (struct sockaddr*)&ss, sslen) != 0) {
+       error("%s: Problem binding source address (%s), errno: %d", __func__, inet_socktop(&ss), socket_errno());
+       perror("bind");
+       bind_failed = 1;
+--- traceroute.cc_	2012-10-05 11:33:54.413552510 +0400
++++ traceroute.cc	2012-10-05 11:34:15.976550750 +0400
+@@ -169,8 +169,6 @@
+ /* A global random token used to distinguish this traceroute's probes from
+    those of other traceroutes possibly running on the same machine. */
+ static u16 global_id;
+-/* A global cache of known hops, indexed by TTL and address. */
+-static std::map<struct HopIdent, Hop *> hop_cache;
+ /* A list of timedout hops, which are not kept in hop_cache, so we can delete
+    all hops on occasion. */
+ static std::list<Hop *> timedout_hops;
+@@ -204,6 +202,9 @@
+   }
+ };
+ 
++/* A global cache of known hops, indexed by TTL and address. */
++static std::map<struct HopIdent, Hop *> hop_cache;
++
+ struct Hop {
+   Hop *parent;
+   struct sockaddr_storage tag;
diff -ruN /usr/ports/security/nmap/files/patch-configure-cxxflags-fix ./files/patch-configure-cxxflags-fix
--- /usr/ports/security/nmap/files/patch-configure-cxxflags-fix	1970-01-01 03:00:00.000000000 +0300
+++ ./files/patch-configure-cxxflags-fix	2012-10-05 10:16:50.000000000 +0400
@@ -0,0 +1,11 @@
+--- _configure	2012-10-05 10:15:36.678551512 +0400
++++ configure	2012-10-05 10:15:45.366548872 +0400
+@@ -2398,7 +2398,7 @@
+      fi
+    if test -d /usr/local/include; then
+      CFLAGS="$CFLAGS -I/usr/local/include"
+-     CXXFLAGS="$CFLAGS -I/usr/local/include"
++     CXXFLAGS="$CXXFLAGS -I/usr/local/include"
+    fi
+ fi
+ 


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list