Skip to content

[build][android] set INSTALL_RPATH properly for shared libraries #30235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,9 @@ function(_add_swift_host_library_single target)
PROPERTIES
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin")
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "ANDROID")
# Only set the install RPATH if cross-compiling the host tools, in which
# case both the NDK and Sysroot paths must be set.
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN")
endif()
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No checks needed now that this is only set for host libraries on Android.

endif()

set_target_properties("${target}" PROPERTIES BUILD_WITH_INSTALL_RPATH YES)
Expand Down
7 changes: 3 additions & 4 deletions stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,9 @@ function(_add_swift_target_library_single target name)
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
endif()
# Only set the install RPATH if cross-compiling the host tools, in which
# case both the NDK and Sysroot paths must be set.
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
# Only set the install RPATH if the toolchain and stdlib will be in Termux
# or some other native sysroot on Android.
if(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN")
Expand Down