We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f1aa94 commit 29e43c4Copy full SHA for 29e43c4
Sources/SwiftlyCore/Platform.swift
@@ -166,6 +166,16 @@ extension Platform {
166
for (key, value) in env {
167
newEnv[key] = value
168
}
169
+
170
+#if os(macOS)
171
+ // On macOS, we try to set SDKROOT if its empty for tools like clang++ that need it to
172
+ // find standard libraries that aren't in the toolchain, like libc++. Here we
173
+ // use xcrun to tell us what the default sdk root should be.
174
+ if newEnv["SDKROOT"] == nil {
175
+ newEnv["SDKROOT"] = (try? await self.runProgramOutput("/usr/bin/xcrun", "--show-sdk-path"))?.replacingOccurrences(of: "\n", with: "")
176
+ }
177
+#endif
178
179
try self.runProgram([command] + arguments, env: newEnv)
180
181
0 commit comments