https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92719
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Nikhil Benesch from comment #5) > Ah, sorry, I was imprecise before. By “system gmp” I meant a gmp installed > by Homebrew, as in `brew install gmp`. So ... I am guessing that the default home-brew installation place is /usr/local? the only way the configury can find things is (1) it's in some well known place (2) you tell it where to find it usually using a --with-xxxx=. > I believe this is a third option from the two you listed. (At least, it is > on non-macOS platforms.) actually, Darwin's behaviour w.r.t to sysroots and suchlike is not different from Linux. What is different is that Linux [and older Darwin] tends to have an installation of the headers etc in /, so for self-hosted builds there's no need for a sysroot. however, modern macOS/Darwin now requires a sysroot (a.k.a SDK) always. >without a `—with-gmp-dir` option, Homebrew’s GMP > installation gets automatically picked up by the top level configure script, > but somehow the configure script in the gcc subdirectory can’t find gmp.h. If something is in /usr/local, then default search paths will find it (the top level configure doesn't prepend a sysroot - but the system compiler [clang] will do - as will any functional GCC used for bootstrap). However - we need a sysroot for Darwin so /some/path/to/the/SDK... Probably, it's somewhat inconsistent that the top level succeeds (the top level ought to fail too if the build/host needs a sysroot). ... but /usr/local does *not* exist relative to that SDK (it's present relative to /) so /some/path/to/the/SDK/usr/local doesn't contain anything (or even exist). the compiler(s) will not add /usr/local to the search paths automatically (they will only add paths onto the sysroot, or relative to the compiler's installation tree). This has been discussed in various PRs - it's actually quite tricky to be sure that it's safe to add /usr/local to the search paths in any automatic way (think, for example, what would happen if cross-compiling from X86_64 => powerpc or Arm64) If this is the situation ... then --with-gmp=/usr/local ought to work. If GMP is installed somewhere else, then it would be interesting to see how the top level config finds it.