Again SIP has brought along some user-visible changes (see previous issue with Apple Mail). With the update of XCode 10 the directory /usr/include
is not available anymore — not even after installing XCode and xcode-select --install
. Without /usr/include
, one cannot compile the GNU Compiler from source anymore. The forum’s preferred solution is to install the package /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Prior to compiling GCC, one needs updated libraries, e.g. using brew: brew update
. Then run brew install gmp mpfr libmpc isl
My configure line for GCC currently is:
../configure --prefix=$PWD/usr --enable-bootstrap --enable-languages=c,c++,fortran,jit,lto --enable-host-shared --disable-multiarch
The options mean:
--prefix=
Installation path is in the present working directory underusr/
. This allows prepending this installation’sbin
directory to myPATH
(and equivalent for the library’s directory toLD_LIBRARY_PATH
) in order to test the new compiler.--enable-bootstrap
After compiling GCC with the system compiler (Apple uses an adapted Clang compiler), recompile GCC with itself in multiple sttages.--enable-languages
Apart from C and C++, compile with the Fortran compiler, the Just-in-Time compilation support (which requires--enable-host-shared
) and link-time-optimization frontend (to allow optimization at the final link-step, which offers more optimization opportunities).--enable-host-shared
The GCC-internal host libraries are build as shared libraries. These are required to be dynamically loadable at runtime by applications compiling just-in-time code.--disable-multilib
Just compile natively for x86_64-architecture, do not compile multi-library version, e.g. 32-bit i386.
Alternatively using --with-native-system-header-dir
one may search for header files in the directory found above, not in the non-existent /usr/include
; so here, this would be --with-native-system-header-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
.
Pingback: Compiling GCC-SVN on MacOS 10.15 | Blog of Jonathan, Elke und Rainer