Author: Danny Milosavljevic <dannym@friendly-machines.com>
Date: 2025-10-20
Subject: Set RPATH for SourceKit
Set RPATH for SourceKit shared libraries on Linux when BOOTSTRAPPING_MODE is not set.
Without this, libsourcekitdInProc.so has no RPATH and cannot find libdispatch.so
and libBlocksRuntime.so in lib/swift/linux/.
--- a/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
+++ b/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
@@ -227,6 +227,10 @@ macro(add_sourcekit_library name)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set_target_properties(${name} PROPERTIES INSTALL_NAME_DIR "@rpath")
+ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+ if(NOT RPATH_LIST)
+ set(RPATH_LIST "$ORIGIN/swift/linux")
+ endif()
endif()
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
set_target_properties(${name} PROPERTIES INSTALL_RPATH "${RPATH_LIST}")