nmap doesn't like libc++ ?
ryandesign at macports.org
Wed Jul 12 16:43:35 UTC 2017
On Jul 12, 2017, at 11:10, Richard L. Hamilton wrote:
> After switching my Snow Leopard over to the toolchain that supports C++11 and favors libc++ instead of libstdc++, I could no longer build nmap; it kept getting undefined symbols like std::logic_error::logic_error (which as used, may be peculiar to libstdc++ instead).
> On a hunch, I tried the plain old Apple compiler (configure.compiler=gcc), and it worked.
> Not sure what's up with this, because I've never run into it before, either on Snow Leopard or on anything newer (El Capitan, Sierra).
> Is nmap doing something that doesn't play equally nicely with both flavors of library, or what? If so, should the Portfile be more specific about what it needs (compiler or library or whatever), so as to be less dependent on a particular macports.conf configuration or toolchain installation?
> Here's what I've got configured:
> sh-3.2# egrep 'default_compilers|cxx_stdlib' macports.conf
> cxx_stdlib libc++
> default_compilers macports-clang-3.9 macports-clang-3.7 macports-clang-3.4 gcc-4.2 apple-gcc-4.2 gcc-4.0
I don't have a libc++-on-older-systems installation to test on, but the ability to use a nonstandard C++ library depends on the build system respecting the CXXFLAGS MacPorts sets, specifically the `-stdlib=...` flag. Ports that don't use standard configure scripts need to take care of that manually. You may encounter ports that aren't doing that, and need to be fixed to do that.
Looking at the nmap portfile, it doesn't look like that's the case. It uses a standard configure script, and passes MacPorts CXXFLAGS to the compiler *most* of the time, but not when building in the liblinear subdirectory. If we look at the Makefile in that directory, we see that in the case of the "lib" target, no flags variables are used with the C++ compiler, and in the case of the other C++ targets, the CFLAGS variable is used instead of the CXXFLAGS variable. This looks to me like a bug in the nmap build system which should be reported to the developers. In the mean time, we should be able to patch that.
More information about the macports-users