apex uses the first arch variant of prebuilt_etc modules
prebult_etc module type does not respect prefer32, i.e. its primary arch
is 64-bit on 64/32-bit device even when built with TARGET_PREFER_32_BIT
is true. However, the apex module type respects prefer32 and therefore
when TARGET_PREFER_32_BIT is true its primary arch becomes 32-bit. Then
the problem is that the apex tries to depend on 32-bit variant of the
prebuilt_etc modules which don't exist.
Fixing the problem by force using the first arch of the device when
adding dependencies to prebuilt_etc modules.
Bug: 144532908
Test: choosecombo 1 aosp_arm64 userdebug; TARGET_PREFER_32_BIT=true m;
Change-Id: I7642c57b05a837495587bbe4d3589d8549607862
diff --git a/apex/apex.go b/apex/apex.go
index c021e1d..03714f7 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -576,10 +576,6 @@
a.properties.Multilib.First.Tests,
target,
a.getImageVariation(config))
-
- // When multilib.* is omitted for prebuilts, it implies multilib.first.
- ctx.AddFarVariationDependencies(target.Variations(),
- prebuiltTag, a.properties.Prebuilts...)
}
switch target.Arch.ArchType.Multilib {
@@ -630,6 +626,22 @@
}
+ // For prebuilt_etc, use the first variant (64 on 64/32bit device,
+ // 32 on 32bit device) regardless of the TARGET_PREFER_* setting.
+ // b/144532908
+ archForPrebuiltEtc := config.Arches()[0]
+ for _, arch := range config.Arches() {
+ // Prefer 64-bit arch if there is any
+ if arch.ArchType.Multilib == "lib64" {
+ archForPrebuiltEtc = arch
+ break
+ }
+ }
+ ctx.AddFarVariationDependencies([]blueprint.Variation{
+ {Mutator: "os", Variation: ctx.Os().String()},
+ {Mutator: "arch", Variation: archForPrebuiltEtc.String()},
+ }, prebuiltTag, a.properties.Prebuilts...)
+
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
javaLibTag, a.properties.Java_libs...)