Question Details

No question body available.

Tags

c++ g++ clang++ zshrc apple-m2

Answers (1)

Accepted Answer Available
Accepted Answer
August 16, 2025 Score: 3 Rep: 24,757 Quality: High Completeness: 70%

Because gcc on brew is built with --with-sysroot, pointing it to a default sysroot other than /.

We can even see this by running strings $(which gcc-14) | fgrep .sdk:

../configure [...] --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk

Upstream clang is just not built that way, so it has its sysroot set to /.


Separate note: you can also use --sysroot=... in place of -isysroot+-L.