Build error of ASan-enabled AOSP 13 for x86_64 Cuttlefish

337 views
Skip to first unread message

Hoyoung Kim

unread,
Mar 27, 2023, 11:36:50 AM3/27/23
to Android Building
Hello, android-building!

I'm trying to build AOSP 13 for x86_64 Cuttlefish with ASan enabled.
I downloaded the source code of android13-gsi branch and selected aosp_cf_x86_64_phone-userdebug target.

However, the following linking error occurred during the building:
(Some logs were omitted to reduce the length, and here is the entire error message: https://www.dropbox.com/s/9qeeld4ouqjhu9s/full-log.txt)

```
[ 44% 6992/15631] //packages/modules/Bluetooth/android/app:libbluetooth_jni link libbluetooth_jni.so [apex33]
FAILED: out/soong/.intermediates/packages/modules/Bluetooth/android/app/libbluetooth_jni/android_x86_64_silvermont_shared_asan_apex33/unstripped/libbluetooth_jni.so
(long command was omitted)
ld.lld: error: undefined symbol: grpc_call_unref
>>> referenced by mod.rs:492 (external/rust/crates/grpcio/src/call/mod.rs:492)
>>>               libbt_shim_ffi.libbluetooth_rs.bluetooth_rs.be682fec-cgu.0.rcgu.o.rcgu.o:(core::ptr::drop_in_place::<grpcio::call::ShareCall>) in archive out/soong/.intermediates/packages/modules/Bluetooth/sys
tem/gd/rust/shim/libbt_shim_ffi/android_x86_64_silvermont_static_asan_apex33/libbt_shim_ffi.a
>>> referenced by mod.rs:492 (external/rust/crates/grpcio/src/call/mod.rs:492)
>>>               libbt_shim_ffi.libbluetooth_rs.bluetooth_rs.be682fec-cgu.0.rcgu.o.rcgu.o:(<alloc::sync::Arc<grpcio::task::executor::SpawnTask>>::drop_slow) in archive out/soong/.intermediates/packages/modules/
Bluetooth/system/gd/rust/shim/libbt_shim_ffi/android_x86_64_silvermont_static_asan_apex33/libbt_shim_ffi.a
>>> referenced by mod.rs:492 (external/rust/crates/grpcio/src/call/mod.rs:492)
>>>               libbt_shim_ffi.libgrpcio.grpcio.86240d56-cgu.0.rcgu.o.rcgu.o:(core::ptr::drop_in_place::<grpcio::task::CallTag>) in archive out/soong/.intermediates/packages/modules/Bluetooth/system/gd/rust/sh
im/libbt_shim_ffi/android_x86_64_silvermont_static_asan_apex33/libbt_shim_ffi.a
>>> referenced 3 more times

(several other similar errors were omitted (ld.lld: error: undefined symbol))

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
22:07:17 ninja failed with: exit status 1

#### failed to build some targets (13:02 (mm:ss)) ####
```

To reproduce the build failure:

```
# Download the source code
$ mkdir workspace
$ cd workspace
$ repo init -u https://android.googlesource.com/platform/manifest -b android13-gsi
$ repo sync

# Build without ASan - successful
$ . build/envsetup.sh
$ lunch aosp_cf_x86_64_phone-userdebug
$ m

# Build with ASan - the error occurs
$ export SANITIZE_TARGET=address m
```

Instead of Cuttlefish, I also tried the traditional emulator with android-13.0.0_r7 branch and aosp_x86_64-eng target.
However, the same ld.lld linking error occurred.

Can I get suggestions for using ASan in Cuttlefish?

Thanks!

Hoyoung Kim

unread,
Mar 27, 2023, 1:28:09 PM3/27/23
to Android Building
I found a typo in my previous post.
Sorry for the confusion.

The problematic build command should be:

```
$ SANITIZE_TARGET=address m
```

not

```
$ export SANITIZE_TARGET=address m
```

I'm still trying to fix this build failure and any help would be highly appreciated!

Reply all
Reply to author
Forward
0 new messages