From 80737dc8971ce373655b54021d60ed57f6ed90ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Mustoha?= Date: Tue, 13 Dec 2016 13:35:25 -0800 Subject: [PATCH] servo: Merge #14528 - Add C++ runtime shared object to the Android APK (from mmatyas:android_cppruntime); r=larsbergstrom At the moment, the Android port requires `libc++_shared.so` to run -- this patch adds the file to the generated APK. Part of #13154. If you know a cleaner way to solve this issue, feel free to share it! Static linking didn't work, see the related issue. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors Source-Repo: https://github.com/servo/servo Source-Revision: 91a223093368be339ad00f42df4214ac36e1be6e --- servo/support/android/build-apk/src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/servo/support/android/build-apk/src/main.rs b/servo/support/android/build-apk/src/main.rs index 234a37e9b515..0f2ad0f2e132 100644 --- a/servo/support/android/build-apk/src/main.rs +++ b/servo/support/android/build-apk/src/main.rs @@ -17,7 +17,7 @@ fn main() { let (args, passthrough) = parse_arguments(); // Find all the native shared libraries that exist in the target directory. - let native_shared_libs = find_native_libs(&args); + let mut native_shared_libs = find_native_libs(&args); // Get the SDK path from the ANDROID_HOME env. let sdk_path = env::var("ANDROID_HOME").ok().expect("Please set the ANDROID_HOME environment variable"); @@ -32,6 +32,14 @@ fn main() { .ok() .expect("Please set the ANDROID_PLATFORM environment variable"); + // Add the C++ runtime .so + { + let libcpp_base_path = ndk_path.join("sources").join("cxx-stl").join("llvm-libc++").join("libs"); + let libcpp_filename = "libc++_shared.so"; + let libcpp_path = libcpp_base_path.join("armeabi").join(libcpp_filename); + native_shared_libs.insert(libcpp_filename.to_string(), libcpp_path); + } + // Get the standalone NDK path from NDK_STANDALONE env. // let standalone_path = env::var("NDK_STANDALONE").ok().unwrap_or("/opt/ndk_standalone".to_string()); // let standalone_path = Path::new(&standalone_path);