Bug 232934

Summary: security/nmap: Fix build with libc++ 7.0
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Li-Wen Hsu <lwhsu>
Status: Closed FIXED    
Severity: Affects Some People CC: dim, lwhsu
Priority: --- Flags: bugzilla: maintainer-feedback? (ohauer)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230606
Bug Depends on:    
Bug Blocks: 230355    
Attachments:
Description Flags
Use ::bind instead plain bind none

Description Dimitry Andric freebsd_committer freebsd_triage 2018-11-03 14:09:52 UTC
Created attachment 198913 [details]
Use ::bind instead plain bind

Building security/nmap on the clang700-import branch results in a bunch of errors due to std::bind conflicting with the good old bind(2):

EchoServer.cc -o EchoServer.o
EchoServer.cc:284:81: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
    if( bind(master_sd, (struct sockaddr *)&server_addr6, sizeof(server_addr6)) != 0 ){
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/usr/include/c++/v1/utility:566:1: note: candidate template ignored: could not match 'pair' against '__bind'
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
[... much more of this ...]

See also http://package18.nyi.freebsd.org/data/headamd64PR230355-default/2018-10-09_18h22m03s/logs/errors/nmap-7.70.log

This is because nmap puts "using namespace std" in its headers.

Attached is a patch to replace the calls to bind(2) with ::bind.
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-12-27 08:51:44 UTC
A commit references this bug:

Author: lwhsu
Date: Thu Dec 27 08:51:32 UTC 2018
New revision: 488514
URL: https://svnweb.freebsd.org/changeset/ports/488514

Log:
  - Fix build with libc++ 7.0

  PR:		232934
  Submitted by:	dim
  Approved by:	maintainer timeout
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/security/nmap/files/patch-nping_EchoServer.cc