Skip to content

Commit 4deff61

Browse files
committed
[NFC][CMake] Disable use of in-process 'libSwiftScan' queries when building the Standard Library
Due to the ordering of our build system, we may encounter a race when building standard library variants using tools produced by Swift's 'tools' CMake build. As a workaround, for now, ensure that the compiler building standard library variants does not rely on libSwiftScan built as part of 'tools'.
1 parent 1965f96 commit 4deff61

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ elseif(SWIFT_PRIMARY_VARIANT_SDK STREQUAL "WINDOWS")
300300
list(APPEND swift_core_private_link_libraries shell32;DbgHelp;Synchronization)
301301
endif()
302302

303+
# There is a race condition with building the 'tools' CMake build of the compiler,
304+
# which produces libSwiftScan that the compiler building the standard library may attempt to use.
305+
# Since the current build system makes establishing this dependency relationship exceedingly difficult,
306+
# we attempt to work around it by disabling use of 'libSwiftScan' here.
307+
list(APPEND swift_stdlib_compile_flags "-nonlib-dependency-scanner")
303308
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
304309
list(APPEND swift_stdlib_compile_flags "-Xllvm" "-sil-inline-generics")
305310
list(APPEND swift_stdlib_compile_flags "-Xllvm" "-sil-partial-specialization")
@@ -452,7 +457,7 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
452457
GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES}
453458
SWIFT_COMPILE_FLAGS
454459
${swift_stdlib_compile_flags} -Xcc -D__MACH__ -Xcc -D__APPLE__ -Xcc -ffreestanding -enable-experimental-feature Embedded
455-
-Xfrontend -enable-ossa-modules
460+
-Xfrontend -enable-ossa-modules -nonlib-dependency-scanner
456461
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
457462
SDK "embedded"
458463
ARCHITECTURE "${arch}"

0 commit comments

Comments
 (0)