I have my own C library (libmylibrary) which I want to use in healthd.
Adding libmylibrary as a dependency of healthd results in the following errors:
FAILED: out/soong/build.ninja
out/soong/.bootstrap/bin/soong_build -t -l out/.module_paths/Android.bp.list -b out/soong -n out -d out/soong/build.ninja.d -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja Android.bp
error: hardware/interfaces/health/2.0/default/Android.bp:52:1: dependency "libmylibrary" of "android.hardware.health@2.0-impl-default" missing variant:
arch:android_arm64_armv8-a_cortex-a53, image:recovery, link:shared
available variants:
arch:android_arm64_armv8-a_cortex-a53, image:core, link:shared, version:
arch:android_arm_armv7-a-neon_cortex-a9, image:core, link:shared, version:
error: hardware/interfaces/health/2.0/default/Android.bp:32:1: dependency "libmylibrary" of "android.hardware.health@2.0-impl" missing variant:
arch:android_arm64_armv8-a_cortex-a53, image:vendor, link:shared, version:
available variants:
arch:android_arm64_armv8-a_cortex-a53, image:core, link:shared, version:
arch:android_arm_armv7-a-neon_cortex-a9, image:core, link:shared, version:
14:35:38 soong bootstrap failed with: exit status 1
I can confirm that libmylibrary exists on the target, it's just when I add it as healthd dependency that I get errors.
$ find . -name "libmylibrary*"
./obj_arm/SHARED_LIBRARIES/libmylibrary_intermediates
./obj_arm/SHARED_LIBRARIES/libmylibrary_intermediates/mylibrary.so
./system/lib/libmylibrary.so
./system/lib64/libmylibrary.so
./symbols/system/lib/libmylibrary.so
./symbols/system/lib64/libmylibrary.so
./obj/SHARED_LIBRARIES/libmylibrary_intermediates
./obj/SHARED_LIBRARIES/libmylibrary_intermediates/libmylibrary.so
What are these variants and how can I fix these errors?
The solution was to add vendor_available
and recovery_available
settings to the library's Android.bp
:
cc_library {
name: "libmylibrary",
vendor_available: true,
recovery_available: true,
srcs: [
"src/chain.c",
"src/fcs.c",
],
cflags: ["-Wall", "-Werror"],
export_include_dirs: ["include"],
sdk_version: "14",
}