I'm trying to build GCC from source and have managed to build all the dependencies, however right now I'm struggling with building GCC itself. In macOS 10.15 Apple deprecated the location /usr/include
, and the build script is trying to locate the headers there, however the headers are located at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
The error:
The directory that should contain system headers does not exist: /usr/includemake[3]: *** [stmp-fixinc] Error 1make[2]: *** [all-stage1-gcc] Error 2make[1]: *** [stage1-bubble] Error 2make: *** [all] Error 2
What I've tried:
- https://developer.apple.com/forums/thread/104296 (outdated, in macOS 10.15 Apple doesn't provide package to install system headers in /usr/include)
configure options:
--with-native-system-header-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
(Trouble building gcc on Mac - can't find system headers)--with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
--with-build-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885)--with-build-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885)
Changing the
oldincludedir
variable in the Makefile (generated by the configure script) from/usr/include
to the correct path.SYSTEM_HEADER_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
Symlinking
/usr/include
with/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
is unfeasible.
Any suggestions are much appreciated!Thanks in advance!