From 64d47e8c4bb23f20befe95b9da3a45769024487a Mon Sep 17 00:00:00 2001 From: Bryanskiy Date: Sat, 16 Jul 2022 19:26:43 +0300 Subject: [PATCH 1/2] add crt-static for android --- src/lib.rs | 4 ---- src/unix/mod.rs | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3ad346a429353..acda091592025 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,10 +26,6 @@ #![deny(missing_copy_implementations, safe_packed_borrows)] #![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)] #![cfg_attr(feature = "rustc-dep-of-std", no_core)] -#![cfg_attr( - feature = "rustc-dep-of-std", - feature(native_link_modifiers, native_link_modifiers_bundle) -)] #![cfg_attr(libc_const_extern_fn_unstable, feature(const_extern_fn))] #[macro_use] diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 1d57f28b2112d..031283c1210d4 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -346,10 +346,17 @@ cfg_if! { } else if #[cfg(target_os = "emscripten")] { #[link(name = "c")] extern {} + } else if #[cfg(all(target_os = "android", feature = "rustc-dep-of-std"))] { + #[link(name = "c", kind = "static", modifiers = "-bundle", + cfg(target_feature = "crt-static"))] + #[link(name = "m", kind = "static", modifiers = "-bundle", + cfg(target_feature = "crt-static"))] + #[link(name = "m", cfg(not(target_feature = "crt-static")))] + #[link(name = "c", cfg(not(target_feature = "crt-static")))] + extern {} } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", - target_os = "android", target_os = "openbsd"))] { #[link(name = "c")] #[link(name = "m")] From d6d7bfdb055f4158fe41a1d5e1ee64de0d31840d Mon Sep 17 00:00:00 2001 From: Bryanskiy Date: Sun, 31 Jul 2022 19:53:55 +0300 Subject: [PATCH 2/2] getting back android traget in case without rustc-dep-of-std --- src/unix/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 031283c1210d4..ecc693e3db105 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -357,6 +357,7 @@ cfg_if! { } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", + target_os = "android", target_os = "openbsd"))] { #[link(name = "c")] #[link(name = "m")]