commit 8189d735d33f91e334725f1824eb9f61de78f138 Date: Tue Apr 21 05:29:36 2020 +0530 On ELF platforms, remove host toolchain rpath from executables and shared libraries before installing. diff --git a/swiftpm/Sources/PackageDescription/CMakeLists.txt b/swiftpm/Sources/PackageDescription/CMakeLists.txt index ea704129..0119cad7 100644 --- a/swiftpm/Sources/PackageDescription/CMakeLists.txt +++ b/swiftpm/Sources/PackageDescription/CMakeLists.txt @@ -47,6 +47,8 @@ foreach(PACKAGE_DESCRIPTION_VERSION 4 4_2) if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) target_link_libraries(PD${PACKAGE_DESCRIPTION_VERSION} PRIVATE Foundation) + target_link_options(PD${PACKAGE_DESCRIPTION_VERSION} PRIVATE + "SHELL:-no-toolchain-stdlib-rpath") set_target_properties(PD${PACKAGE_DESCRIPTION_VERSION} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH "$ORIGIN/../../$") diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap index ef703dc1..4ee5fff9 100755 --- a/swiftpm/Utilities/bootstrap +++ b/swiftpm/Utilities/bootstrap @@ -678,6 +678,11 @@ def get_swiftpm_flags(args): if 'ANDROID_DATA' in os.environ: build_flags.extend(["-Xswiftc", "-Xcc", "-Xswiftc", "-U_GNU_SOURCE"]) + # On ELF platforms, remove the host toolchain's stdlib absolute rpath from + # installed executables and shared libraries. + if platform.system() != "Darwin" and args.command == 'install': + build_flags.extend(["-Xswiftc", "-no-toolchain-stdlib-rpath"]) + build_target = get_build_target(args) cross_compile_hosts = args.cross_compile_hosts if build_target == 'x86_64-apple-macosx' and "macosx-arm64" in cross_compile_hosts: