Closed kumom closed 1 year ago
You are encountering at least one problem which is not to do with GCC, but to do with Xcode clang.... (1 and 2 below).
Also, I recommend adding --build=aarch64-apple-darwin22 to the configuration line (for darwin22 / ventura) so that the resulting compiler will have names like aarch64-apple-darwin22-gcc. [ that is helpful if you then want to use that compiler as the build one, since the name is then easier to remember].
We have three issues here:
When you use clang as the bootstrap compiler, it pretends to be GCC
so it claims "gcc" and "g++" .. it does this even if you place a newer GCC first in the PATH.
this can cause some misconfiguration, since clang does not actually support all the GCC flags and builtins.
so, when you use clang it is better to use CC=clang CXX=clang++ on the configuration line.
I will try to produce a fix for (3) during this week.
You can use a bootstrapped GCC as the build compiler for a non-bootstrap build (so that you first make a compiler using bootstrap, and then use that in a --disable-bootstrap build (I do this quite often for debugging).. That then means you then have an up-to-date GCC as the bootstrap compiler, and it has all the flags and builtins as expected.
NOTE: because of (2) you should add CC=aarch64-apple-darwin22-gcc CXX=aarch64-apple-darwin22-g++ to the configuration to make sure of using the correct build compiler.
this issue should be fixed in the latest sources;
however the advice remains: non-bootstrap builds starting from a non-GCC or old-GCC compiler are not intended or recommended and will not necessarily be reliable.
With the following configuration
$HOME/dropbox/projects/gcc-darwin-arm64/configure --disable-bootstrap --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk --prefix=$PWD
I encountered the error
But building with bootstrapping works fine on my machine (Apple M2, macOS Ventura 13.0).