From 2f63457354ad618934545d02422adb29ee2be4fe Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 13 Nov 2023 12:12:06 -0800 Subject: [PATCH] Avoid conflicts between architectures in prebuilt_renderscript_bitcode The NDK build has 4 architectures, x86 and arm 32-bit architectures and x86_64 and arm64 64-bit architectures. Multilib on its own is not enough to prevent collisions in install locations. Detect conflicts and add the architecture to the path the same way cc/installer.go does. Bug: 308212344 Test: OUT_DIR=out build/soong/scripts/build-ndk-prebuilts.sh Change-Id: If7a1b062035dda87f5f8129062778c41c43de17b --- etc/prebuilt_etc.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go index 275d9c3ff..b7d29710d 100644 --- a/etc/prebuilt_etc.go +++ b/etc/prebuilt_etc.go @@ -150,8 +150,9 @@ type PrebuiltEtc struct { sourceFilePath android.Path outputFilePath android.OutputPath // The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share. - installDirBase string - installDirBase64 string + installDirBase string + installDirBase64 string + installAvoidMultilibConflict bool // The base install location when soc_specific property is set to true, e.g. "firmware" for // prebuilt_firmware. socInstallDirBase string @@ -355,6 +356,10 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) { if p.SocSpecific() && p.socInstallDirBase != "" { installBaseDir = p.socInstallDirBase } + if p.installAvoidMultilibConflict && !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) { + installBaseDir = filepath.Join(installBaseDir, ctx.Arch().ArchType.String()) + } + p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, p.SubDir()) // Call InstallFile even when uninstallable to make the module included in the package @@ -590,6 +595,7 @@ func PrebuiltRenderScriptBitcodeFactory() android.Module { module := &PrebuiltEtc{} module.makeClass = "RENDERSCRIPT_BITCODE" module.installDirBase64 = "lib64" + module.installAvoidMultilibConflict = true InitPrebuiltEtcModule(module, "lib") // This module is device-only android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibBoth)