• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/base/Android.bp b/base/Android.bp
2index a3fe04d9..55ab423c 100644
3--- a/base/Android.bp
4+++ b/base/Android.bp
5@@ -13,8 +13,6 @@ package {
6 rust_test {
7     name: "base_test_src_lib",
8     defaults: ["crosvm_defaults"],
9-    // has rustc warnings
10-    host_supported: true,
11     crate_name: "base",
12     cargo_env_compat: true,
13     cargo_pkg_version: "0.1.0",
14@@ -22,7 +20,7 @@ rust_test {
15     test_suites: ["general-tests"],
16     auto_gen_config: true,
17     test_options: {
18-        unit_test: false,
19+        unit_test: true,
20     },
21     edition: "2021",
22     rustlibs: [
23@@ -44,14 +42,31 @@ rust_test {
24         "libbase_poll_token_derive",
25         "libremain",
26     ],
27-    static_libs: ["libstdio_fileno"],
28+    target: {
29+        android: {
30+            rustlibs: ["libandroid_log_sys"],
31+        },
32+        linux_bionic_arm64: {
33+            // For ARM architecture, we use aarch64-linux-android for BOTH
34+            // device and host targets. As a result, host targets are also
35+            // built with target_os = "android". Therefore, sys_util/src/android
36+            // is used and thus this android module is required.
37+            // This seems incorrect, but is inevitable because rustc doesn't
38+            // yet support a Linux-based target using Bionic as libc. We can't
39+            // use aarch64-unknown-linux-gnu because it's using glibc which
40+            // we don't support for cross-host builds.
41+            rustlibs: [
42+                "libandroid_log_sys",
43+            ],
44+        },
45+    },
46+    shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
47 }
48
49 rust_library {
50     name: "libbase_rust",
51     defaults: ["crosvm_defaults"],
52     stem: "libbase",
53-    // has rustc warnings
54     host_supported: true,
55     crate_name: "base",
56     cargo_env_compat: true,
57@@ -77,5 +92,23 @@ rust_library {
58         "libbase_poll_token_derive",
59         "libremain",
60     ],
61-    static_libs: ["libstdio_fileno"],
62+    target: {
63+        android: {
64+            rustlibs: ["libandroid_log_sys"],
65+        },
66+        linux_bionic_arm64: {
67+            // For ARM architecture, we use aarch64-linux-android for BOTH
68+            // device and host targets. As a result, host targets are also
69+            // built with target_os = "android". Therefore, sys_util/src/android
70+            // is used and thus this android module is required.
71+            // This seems incorrect, but is inevitable because rustc doesn't
72+            // yet support a Linux-based target using Bionic as libc. We can't
73+            // use aarch64-unknown-linux-gnu because it's using glibc which
74+            // we don't support for cross-host builds.
75+            rustlibs: [
76+                "libandroid_log_sys",
77+            ],
78+        },
79+    },
80+    shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
81 }
82