https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
--- Comment #3 from Jeremy Huddleston Sequoia <jeremyhu at macports dot org> --- I'm not sure what you mean by using --prefix "instead" ... I'm using --prefix to establish where I want the tools to be installed to. As an example, if I wanted to install gcc to /opt/gcc6/bin/gcc, I'd use --prefix=/opt/gcc6. However, the system headers (i.e., /usr/include/stdlib.h) are located in the macOS SDK (not at /usr/include), so it looks like I should be passing --with-build-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk to configure. Or am I misunderstanding the purpose of this configure option? Our build system (MacPorts) is already setting up '-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk' in CPPFLAGS, CFLAGS, CXXFLAGS, OBJCFLAGS, OBJCXXFLAGS and adding '-Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk to LDFLAGS' ... which is sufficient for most other projects, but GCC's a difficult beast to tame. FWIW, I worked around this by just editing SYSTEM_HEADER_DIR in gcc/Makefile.in before running configure. Another related issue is that CPP and CXXCPP need to be explicitly set in the environment because the test for discovering them does not use CPPFLAGS and thus fails, so /lib/cpp is used as fallback (which is not correct).