This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/79885] fix-includes does not honor the value passed to --with-build-sysroot=, looks for /usr/include instead of looking within the SDK
- From: "jeremyhu at macports dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 06 Mar 2017 06:15:41 +0000
- Subject: [Bug other/79885] fix-includes does not honor the value passed to --with-build-sysroot=, looks for /usr/include instead of looking within the SDK
- Auto-submitted: auto-generated
- References: <bug-79885-4@http.gcc.gnu.org/bugzilla/>
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).