Skip to content

Commit 8ee3f51

Browse files
authored
Merge pull request #7354 from rintaro/5.9.0-swift-swift-linux
[5.9.0][lldb][Swift][CMake] Correct RUNPATH in Linux builds
2 parents 71b6f8f + 240bddc commit 8ee3f51

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,24 @@ function(add_properties_for_swift_modules target reldir)
195195
target_link_libraries(${target} PRIVATE swiftCore-linux-${arch})
196196
string(TOLOWER ${CMAKE_SYSTEM_NAME} platform)
197197
set(SWIFT_BUILD_RPATH "${LLDB_SWIFT_LIBS}/${platform}")
198-
set(SWIFT_INSTALL_RPATH "$ORIGIN/swift/${platform}")
198+
set(SWIFT_INSTALL_RPATH "$ORIGIN/${reldir}lib/swift/${platform}")
199199
endif()
200200

201201
set_property(TARGET ${target} APPEND PROPERTY BUILD_RPATH "${SWIFT_BUILD_RPATH}")
202202
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}")
203203

204204
if (SWIFT_SWIFT_PARSER)
205-
set_property(TARGET ${target}
206-
APPEND PROPERTY BUILD_RPATH "@loader_path/${build_reldir}lib/swift/host")
207-
set_property(TARGET ${target}
208-
APPEND PROPERTY INSTALL_RPATH "@loader_path/${reldir}lib/swift/host")
205+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
206+
set_property(TARGET ${target}
207+
APPEND PROPERTY BUILD_RPATH "@loader_path/${build_reldir}lib/swift/host")
208+
set_property(TARGET ${target}
209+
APPEND PROPERTY INSTALL_RPATH "@loader_path/${reldir}lib/swift/host")
210+
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD")
211+
set_property(TARGET ${target}
212+
APPEND PROPERTY BUILD_RPATH "$ORIGIN/${build_reldir}lib/swift/host")
213+
set_property(TARGET ${target}
214+
APPEND PROPERTY INSTALL_RPATH "$ORIGIN/${reldir}lib/swift/host")
215+
endif()
209216
endif()
210217
endif()
211218
endfunction()

lldb/source/API/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ endif()
149149
# BEGIN Swift Mods
150150
# Note that add_properties_for_swift_modules appends RPATHs so it's critical
151151
# that this is called after lldb_setup_rpaths.
152-
add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../")
152+
if(LLDB_BUILD_FRAMEWORK)
153+
add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../")
154+
else()
155+
add_properties_for_swift_modules(liblldb "../")
156+
endif()
153157
# END Swift Mods
154158

155159
if(LLDB_ENABLE_PYTHON)

0 commit comments

Comments
 (0)