Skip to content

Commit 962e330

Browse files
committed
[CMake with Swift] Add toolchain lib path for stage != 0 bootstrapping builds.
Fixes a linker failure where we cannot find the compatibility libraries.
1 parent 5cf1cb3 commit 962e330

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,12 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
579579
target_link_directories(${target} PRIVATE "${sdk_dir}")
580580
581581
# Include the abi stable system stdlib in our rpath.
582-
set(swift_runtime_rpath "/usr/lib/swift")
582+
set(swift_runtime_rpath "/usr/lib/swift")
583+
584+
# Add in the toolchain directory so we can grab compatibility libraries
585+
get_filename_component(TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
586+
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" ABSOLUTE)
587+
target_link_directories(${target} PUBLIC ${TOOLCHAIN_LIB_DIR})
583588
endif()
584589
endif()
585590
endif()

tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ function(add_sourcekit_swift_runtime_link_flags target path HAS_SWIFT_MODULES)
167167
target_link_directories(${target} PRIVATE "${sdk_dir}")
168168

169169
# Include the abi stable system stdlib in our rpath.
170-
set(swift_runtime_rpath "/usr/lib/swift")
170+
set(swift_runtime_rpath "/usr/lib/swift")
171+
172+
# Add in the toolchain directory so we can grab compatibility libraries
173+
get_filename_component(TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
174+
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" ABSOLUTE)
175+
target_link_directories(${target} PUBLIC ${TOOLCHAIN_LIB_DIR})
171176
endif()
172177
endif()
173178
endif()

0 commit comments

Comments
 (0)