From 961cf1cf9c59d54dc5693ca156f3eb79caab1102 Mon Sep 17 00:00:00 2001 From: Rebecca Chyung Date: Mon, 3 Apr 2023 05:17:17 +0000 Subject: [PATCH] Revert "Fix NDK library sysroot arrangement." This reverts commit 169256f5354a1d8d61cf6998d016235e5c344ab4. Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/build-details/9868109/targets/mokey-userdebug, bug b/276513771 Change-Id: Iea77994cd4ff0f61a8fa72e52cd1b601bc7cc1a0 --- cc/library.go | 4 +++- cc/ndk_library.go | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cc/library.go b/cc/library.go index 23311d5eb..1b579cd6e 100644 --- a/cc/library.go +++ b/cc/library.go @@ -26,6 +26,7 @@ import ( "android/soong/android" "android/soong/bazel" "android/soong/bazel/cquery" + "android/soong/cc/config" "github.com/google/blueprint" "github.com/google/blueprint/pathtools" @@ -2255,7 +2256,8 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { !ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() && library.baseLinker.sanitize.isUnsanitizedVariant() && ctx.isForPlatform() && !ctx.isPreventInstall() { - installPath := getUnversionedLibraryInstallPath(ctx).Join(ctx, file.Base()) + installPath := getNdkSysrootBase(ctx).Join( + ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base()) ctx.ModuleBuild(pctx, android.ModuleBuildParams{ Rule: android.Cp, diff --git a/cc/ndk_library.go b/cc/ndk_library.go index a82436135..2473ba2a3 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -528,20 +528,17 @@ func (stub *stubDecorator) nativeCoverage() bool { return false } -// Returns the install path for unversioned NDK libraries (currently only static -// libraries). -func getUnversionedLibraryInstallPath(ctx ModuleContext) android.InstallPath { - return getNdkSysrootBase(ctx).Join(ctx, "usr/lib", config.NDKTriple(ctx.toolchain())) -} - -// Returns the install path for versioned NDK libraries. These are most often -// stubs, but the same paths are used for CRT objects. -func getVersionedLibraryInstallPath(ctx ModuleContext, apiLevel android.ApiLevel) android.InstallPath { - return getUnversionedLibraryInstallPath(ctx).Join(ctx, apiLevel.String()) -} - func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) { - installDir := getVersionedLibraryInstallPath(ctx, stub.apiLevel) + arch := ctx.Target().Arch.ArchType.Name + // arm64 isn't actually a multilib toolchain, so unlike the other LP64 + // architectures it's just installed to lib. + libDir := "lib" + if ctx.toolchain().Is64Bit() && arch != "arm64" { + libDir = "lib64" + } + + installDir := getNdkInstallBase(ctx).Join(ctx, fmt.Sprintf( + "platforms/android-%s/arch-%s/usr/%s", stub.apiLevel, arch, libDir)) stub.installPath = ctx.InstallFile(installDir, path.Base(), path) }