Skip to content

Commit 7e5db61

Browse files
committed
Disuse unversioned triples on non-Darwin platforms.
The target flag should take the versioned triple, otherwise on platforms with versioned triples, the standard library won't be found. On Darwin, the unversioned triple should still be used throughout. This necessitates special-casing in the bootstrap script and when making subdirectories during the build. See TSC pr #229.
1 parent 5e4695d commit 7e5db61

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Sources/Commands/SwiftTool.swift

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,14 @@ public class SwiftTool {
656656
// FIXME: At the moment we just pass the built products directory for the host. We will need to extend this
657657
// with a map of the names of tools available to each plugin. In particular this would not work with any
658658
// binary targets.
659-
let builtToolsDir = dataDir.appending(components: try self._hostToolchain.get().triple.tripleString, buildEnvironment.configuration.dirname)
659+
let hostTriple = try self._hostToolchain.get().triple
660+
let tripleString: String
661+
if hostTriple.isDarwin() {
662+
tripleString = hostTriple.tripleString(forPlatformVersion: "")
663+
} else {
664+
tripleString = hostTriple.tripleString
665+
}
666+
let builtToolsDir = dataDir.appending(components: tripleString, buildEnvironment.configuration.dirname)
660667
let diagnostics = DiagnosticsEngine()
661668

662669
// Create the cache directory, if needed.
@@ -768,8 +775,14 @@ public class SwiftTool {
768775
// Use "apple" as the subdirectory because in theory Xcode build system
769776
// can be used to build for any Apple platform and it has it's own
770777
// conventions for build subpaths based on platforms.
771-
let dataPath = buildPath.appending(
772-
component: options.buildSystem == .xcode ? "apple" : triple.tripleString)
778+
let subdir: String
779+
if triple.isDarwin() {
780+
let unversionedTriple = triple.tripleString(forPlatformVersion: "")
781+
subdir = options.buildSystem == .xcode ? "apple" : unversionedTriple
782+
} else {
783+
subdir = triple.tripleString
784+
}
785+
let dataPath = buildPath.appending(component: subdir)
773786
return BuildParameters(
774787
dataPath: dataPath,
775788
configuration: options.configuration,

Utilities/bootstrap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,9 @@ def get_build_target(args, cross_compile=False):
291291
target_info_json = subprocess.check_output(command,
292292
stderr=subprocess.PIPE, universal_newlines=True).strip()
293293
args.target_info = json.loads(target_info_json)
294-
return args.target_info["target"]["unversionedTriple"]
294+
if platform.system() == 'Darwin':
295+
return args.target_info["target"]["unversionedTriple"]
296+
return args.target_info["target"]["triple"]
295297
except Exception as e:
296298
# Temporary fallback for Darwin.
297299
if platform.system() == 'Darwin':

0 commit comments

Comments
 (0)