Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Sources/SwiftlyCore/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ extension Platform {
newEnv[key] = value
}

#if os(macOS)
// On macOS, we try to set SDKROOT if its empty for tools like clang++ that need it to
// find standard libraries that aren't in the toolchain, like libc++. Here we
// use xcrun to tell us what the default sdk root should be.
if newEnv["SDKROOT"] == nil {
newEnv["SDKROOT"] = (try? await self.runProgramOutput("/usr/bin/xcrun", "--show-sdk-path"))?.replacingOccurrences(of: "\n", with: "")
}
#endif

try self.runProgram([commandToRun] + arguments, env: newEnv)
}

Expand Down