#52634: -snodejs4 build failure — type_traits not found when targetting mac OS 10.8 -----------------------+-------------------------------- Reporter: william@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Keywords: | Port: nodejs4 -----------------------+-------------------------------- Building on current mac OS 10.12 with current Xcode 8.0. main.log attached. Problem arises due to the presence of the following lines in my macports.conf: {{{ macosx_deployment_target 10.8 configure.macosx_deployment_target 10.8 cxx_stdlib libc++ configure.cxx_stdlib libc++ cxxflags -std=c++14 configure.cxxflags -std=c++14 }}} I'm aware that to do this is not particularly supported, but it does often work (!), and the fix here does not break more “normal” builds. In this case, the build fails since it is not able to find type_traits. In particular, the following build line fails for that reason: {{{ /usr/bin/clang++ '-D_DARWIN_USE_64_BIT_INODE=1' '-DGTEST_DONT_DEFINE_ASSERT_EQ=1' '-DGTEST_DONT_DEFINE_ASSERT_GE=1' '-DGTEST_DONT_DEFINE_ASSERT_GT=1' '-DGTEST_DONT_DEFINE_ASSERT_LE=1' '-DGTEST_DONT_DEFINE_ASSERT_LT=1' '-DGTEST_DONT_DEFINE_ASSERT_NE=1' -I../deps/gtest/include -I../deps/v8/include -I../src -I/opt/local/include -Os -gdwarf-2 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++0x -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno- strict-aliasing -MMD -MF /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.6.0/out/Release/.deps//opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.6.0/out/Release/obj.target/cctest/test/cctest/util.o.d.raw -Os -c -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs4/nodejs4/work/node-v4.6.0/out/Release/obj.target/cctest/test/cctest/util.o ../test/cctest/util.cc }}} In testing, I find that if the environment variable is set: `MACOSX_DEPLOYMENT_TARGET=10.8` then I receive the same error. If that variable is empty then the file compiles correctly. {{{ In file included from ../test/cctest/util.cc:1: ../src/util.h:11:10: fatal error: 'type_traits' file not found #include <type_traits> // std::remove_reference ^ 1 error generated. }}} This error may be prevented by adding the argument `-stdlib=libc++` to the command line. I assume this is because when building for mac OS 10.12 libstdc++ is the standard version of the C++ runtime to use, whereas when targetting 10.8 libstdc++ is the default, which misses this library. That diagnosis may of course be wrong. The solution, then, is to add the -stdlib=libc++ argument to build lines unconditionally (it does no harm on systems which already have that as the default). I'm having a nose around to see how that is achieved, since the build system here clearly ignores the cxx_stdlib variables set in macports.conf … -- Ticket URL: <https://trac.macports.org/ticket/52634> MacPorts <https://www.macports.org/> Ports system for the Mac operating system