Skip to content

Commit

Permalink
android: do not add rpaths when linking
Browse files Browse the repository at this point in the history
the dynamic linker doesn't understand them and spams warnings.
  • Loading branch information
zhuowei committed Dec 18, 2015
1 parent c102d20 commit 97dfba0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ function(_add_swift_library_single target name)
set_target_properties("${target}"
PROPERTIES
INSTALL_NAME_DIR "${install_name_dir}")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT "${SWIFTLIB_SINGLE_SDK}" STREQUAL "ANDROID")
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux")
Expand Down
16 changes: 9 additions & 7 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,15 +1033,17 @@ toolchains::Linux::constructInvocation(const LinkJobAction &job,

Arguments.push_back("-lgcc");
Arguments.push_back("-lc");
} else {
// rpaths are not supported on Android.

// FIXME: We probably shouldn't be adding an rpath here unless we know ahead
// of time the standard library won't be copied.
Arguments.push_back("-Xlinker");
Arguments.push_back("-rpath");
Arguments.push_back("-Xlinker");
Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));
}

// FIXME: We probably shouldn't be adding an rpath here unless we know ahead
// of time the standard library won't be copied.
Arguments.push_back("-Xlinker");
Arguments.push_back("-rpath");
Arguments.push_back("-Xlinker");
Arguments.push_back(context.Args.MakeArgString(RuntimeLibPath));

// Always add the stdlib
Arguments.push_back("-lswiftCore");

Expand Down

0 comments on commit 97dfba0

Please sign in to comment.