Skip to content

Commit 72e785e

Browse files
committed
Disable in-process target-info and supported-features queries using libSwiftScan
When building the compiler toolchain, there is currently a race condition which makes it so that the 'libSwiftScan.dylib' is not ready by the time the driver is used to begin compilation of the Swift standard library. For now, disable in-process queries altogether. On 'main', this is resolved with swiftlang/swift#77606, which seems to be a challenge to backport to 6.0.
1 parent 2f500f2 commit 72e785e

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

Sources/SwiftDriver/Jobs/EmitSupportedFeaturesJob.swift

+10-8
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ extension Driver {
6464
fileSystem: FileSystem,
6565
executor: DriverExecutor)
6666
throws -> Set<String> {
67-
do {
68-
if let supportedArgs =
69-
try querySupportedCompilerArgsInProcess(of: toolchain, fileSystem: fileSystem) {
70-
return supportedArgs
71-
}
72-
} catch {
73-
diagnosticsEngine.emit(.remark_inprocess_supported_features_query_failed(error.localizedDescription))
74-
}
67+
// Disable in-process supported features query due to a race condition in the compiler's current
68+
// build system where libSwiftScan may not be ready when building the Swift standard library.
69+
// do {
70+
// if let supportedArgs =
71+
// try querySupportedCompilerArgsInProcess(of: toolchain, fileSystem: fileSystem) {
72+
// return supportedArgs
73+
// }
74+
// } catch {
75+
// diagnosticsEngine.emit(.remark_inprocess_supported_features_query_failed(error.localizedDescription))
76+
// }
7577

7678
// Fallback: Invoke `swift-frontend -emit-supported-features` and decode the output
7779
let frontendOverride = try FrontendOverride(&parsedOptions, diagnosticsEngine)

Sources/SwiftDriver/Jobs/PrintTargetInfoJob.swift

+12-10
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,18 @@ extension Driver {
248248
using: executor.resolver)
249249
Self.sanitizeCommandForLibScanInvocation(&command)
250250

251-
do {
252-
if let targetInfo =
253-
try Self.queryTargetInfoInProcess(of: toolchain, fileSystem: fileSystem,
254-
workingDirectory: workingDirectory,
255-
invocationCommand: command) {
256-
return targetInfo
257-
}
258-
} catch {
259-
diagnosticsEngine.emit(.remark_inprocess_target_info_query_failed(error.localizedDescription))
260-
}
251+
// Disable in-process target query due to a race condition in the compiler's current
252+
// build system where libSwiftScan may not be ready when building the Swift standard library.
253+
// do {
254+
// if let targetInfo =
255+
// try Self.queryTargetInfoInProcess(of: toolchain, fileSystem: fileSystem,
256+
// workingDirectory: workingDirectory,
257+
// invocationCommand: command) {
258+
// return targetInfo
259+
// }
260+
// } catch {
261+
// diagnosticsEngine.emit(.remark_inprocess_target_info_query_failed(error.localizedDescription))
262+
// }
261263

262264
// Fallback: Invoke `swift-frontend -print-target-info` and decode the output
263265
return try executor.execute(

0 commit comments

Comments
 (0)