Skip to content

Commit bf0081a

Browse files
committed
[CMake] Fatal error when bootstrapping is not "hosttools"
and Swift parser integration is enabled. If swift parser integration is enabled, SwiftSyntax libraries are always built with host tools. Other SwiftCompilerSources modules must use the same runtime with parser libraries. (cherry picked from commit 0f0c492)
1 parent 16bf7a3 commit bf0081a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,10 @@ if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
958958
else()
959959
set(SWIFT_SWIFT_PARSER TRUE)
960960
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})
961+
962+
if(SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX" AND NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
963+
message(FATAL_ERROR "Only BOOTSTRAPPING=HOSTTOOLS is supported in Linux when Swift parser integration is enabled")
964+
endif()
961965
endif()
962966
endif()
963967

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,8 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
132132

133133
file(RELATIVE_PATH relative_rtlib_path "${path}" "${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
134134
list(APPEND RPATH_LIST "$ORIGIN/${relative_rtlib_path}")
135-
136-
if(ASKD_BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
137-
list(APPEND RPATH_LIST "${host_lib_dir}")
138-
endif()
135+
# NOTE: SourceKit components are NOT executed before stdlib is built.
136+
# So there's no need to add RUNPATH to builder's runtime libraries.
139137

140138
elseif(ASKD_BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")
141139
get_bootstrapping_swift_lib_dir(bs_lib_dir "")

0 commit comments

Comments
 (0)