Skip to content

Commit b86ab4d

Browse files
GCC on macOS: support both Xcode or Command Line Utilities
Based on Simon Wright's blog post: https://forward-in-code.blogspot.com/2022/03/which-sdk-choices-choices.html
1 parent 24983b2 commit b86ab4d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

specs/gcc.anod

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,12 @@ class GCC(spec("gh-artifact")):
129129
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100340
130130
args.append("--without-build-config")
131131

132-
args.append(
133-
"--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
134-
)
132+
xcode = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
133+
clu = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
134+
135+
args.append("--with-build-sysroot=%s" % xcode)
136+
args.append("--with-specs=%%{!sysroot=*:--sysroot=%%:if-exists-else(%s %s)}" %
137+
(xcode, clu))
135138

136139
if self.env.host.os.name != "darwin":
137140
args.append("--with-gnu-ld")

0 commit comments

Comments
 (0)