简体   繁体   English

Android NDK-试图链接不存在的预构建库的构建

[英]Android NDK - Build Trying to Link Non-Existent Prebuilt Library

I just inherited some legacy code, which is currently able to build on our build server and I am trying to get it run on Android Studio, and it is having issue where the build fails because it is trying to point to a (non-existent) MIPS version of a prebuilt library. 我刚刚继承了一些旧代码,目前可以在我们的构建服务器上进行构建,并且我试图使其在Android Studio上运行,但是由于尝试指向一个(不存在)构建失败,因此出现问题)预编译库的MIPS版本。

I get the following error: 我收到以下错误:

libraryname: LOCAL_SRC_FILES points to a missing file.
Check that .../libraryname/mips/libraryname.so exists.

This file does not exist, but I don't understand why the build tool is looking for it. 该文件不存在,但是我不明白为什么构建工具正在寻找它。

My Application.mk file has this entry: 我的Application.mk文件具有以下条目:

APP_ABI := armeabi armeabi-v7a x86 x86_64

My Android.mk file has this entry (library name generalized): 我的Android.mk文件具有以下条目(通用库名):

include $(CLEAR_VARS)
LIBRARY_NAME_PATH := libraryname/$(TARGET_ARCH_ABI)
LOCAL_MODULE := modulename
LOCAL_SRC_FILES := $(LIBRARY_NAME_PATH)/mobulename.so
include $(PREBUILT_SHARED_LIBRARY)

Confusingly, TARGET_ARCH_ABI doesn't seem to be set anywhere, so I'm not really sure what is happening there. 令人困惑的是, TARGET_ARCH_ABI似乎没有设置在任何地方,因此我不确定该怎么回事。

Other notes, when I build this from the command line with NDK-build, it works just fine, only creating the 4 architectures requested. 其他说明,当我使用NDK-build从命令行构建它时,它工作得很好,仅创建了请求的4种体系结构。

As I mentioned, there should be no need for any code changes, since this exact code is successfully building on our build server. 如前所述,由于此确切的代码已在我们的构建服务器上成功构建,因此无需更改任何代码。 I am assuming I just have something configured wrong. 我假设我的配置错误。

Traditionally, NDK used APP_ABIS setting (usually defined in Application.mk file) to choose the list of architectures to build. 传统上,NDK使用APP_ABIS设置(通常在Application.mk文件中定义)来选择要构建的体系结构列表。 NDK supports today ARM, Intel and MIPS processors in 32 and 64-bit modes. NDK现在支持32位和64位模式的ARM,Intel和MIPS处理器。

The gradle plugin used by Android Studio ignores APP_ABIS and you must define abiFilters in your build.gradle to specify the architectures to build. 由Android工作室使用的插件的gradle 忽略APP_ABIS ,你必须在你的build.gradle定义abiFilters指定的架构来构建。

This is especially important when your project uses prebuilt third-party libraries, because quite often, as in your case, these libraries are available only to a subset of all possible architectures. 当您的项目使用预构建的第三方库时,这一点尤其重要,因为与您的情况一样,这些库通常仅对所有可能的体系结构的子集可用。

ndk-build invokes the Android.mk script in a loop, each time setting $(TARGET_ARCH_ABI) to chosen architecture, one of arm64-v8a x86_64 mips64 armeabi-v7a armeabi x86 mips ndk-build循环调用Android.mk脚本,每次将$(TARGET_ARCH_ABI)设置$(TARGET_ARCH_ABI)所选架构时, arm64-v8a x86_64 mips64 armeabi-v7a armeabi x86 mips

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM