如何解决库变体问题?
How to fix library variant issues?
我有自己的 C 库 (libmylibrary),我想在 healthd 中使用它。
将 libmylibrary 添加为 healthd 的依赖项会导致以下错误:
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
我可以确认 libmylibrary 存在于目标上,只是当我将其添加为 healthd 依赖项时出现错误。
$ 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
这些变体是什么?我该如何修复这些错误?
解决方案是将 vendor_available
和 recovery_available
设置添加到库的 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",
}
我有自己的 C 库 (libmylibrary),我想在 healthd 中使用它。
将 libmylibrary 添加为 healthd 的依赖项会导致以下错误:
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
我可以确认 libmylibrary 存在于目标上,只是当我将其添加为 healthd 依赖项时出现错误。
$ 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
这些变体是什么?我该如何修复这些错误?
解决方案是将 vendor_available
和 recovery_available
设置添加到库的 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",
}