ERROR: Unknown host CPU architecture: arm64

1、先检查NDK版本是否支持arm64,NDK版本21.3以上

2、检查gradle中,有关NDK版本是否设置arm64-v8a

例如:

 ndkVersion "21.4.7075529"
 ndk {
       abiFilters "armeabi-v7a","arm64-v8a"
 }

local.properties中,是否正确设置ndk路径,根据自己实际保存路径设置

例如:

ndk.dir=/Users/***/Library/Android/sdk/ndk/21.4.7075529
sdk.dir=/Users/***/Library/Android/sdk

gradle.properties中是否有APP_ABI相关设置,是否包含arm64-v8a

例如:

# List of CPU Archtexture to build that application with
# Available architextures (armeabi-v7a | arm64-v8a | x86)
# To build for multiple architexture, use the `:` between them
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86:x86_64

PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86:x86_64

3、可能是Mac电脑M系列arm架构问题

修改ndk目录下的ndk-build

cd 到ndk指定版本目录下,例如:

cd /Users/***/Library/Android/sdk/ndk/21.4.7075529 

使用nano命令修改ndk-build,存在权限问题使用sudo, 然后输入密码

sudo nano ndk-build   

修改

#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
$DIR/build/ndk-build "$@"

#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
arch -x86_64 /bin/bash $DIR/build/ndk-build "$@"

编辑完文件后,按下 Ctrl + O 来保存(不会立即退出)。

然后,按 Enter 键确认文件名

最后,按 Ctrl + X 退出 nano

再重新在项目中执行clean 和build 

root@ubuntu:/share/valgrind-3.15/valgrind-3.15.0# ./configure --host=arm-unknown-linux-gnueabihf --prefix=/share/valgrind-3.15/valgrind-3.15.0/_install/ checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-unknown-linux-gnueabihf-strip... arm-unknown-linux-gnueabihf-strip checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether to enable maintainer-specific portions of Makefiles... no checking whether ln -s works... yes checking for arm-unknown-linux-gnueabihf-gcc... arm-unknown-linux-gnueabihf-gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... yes checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether arm-unknown-linux-gnueabihf-gcc accepts -g... yes checking for arm-unknown-linux-gnueabihf-gcc option to accept ISO C89... none needed checking whether arm-unknown-linux-gnueabihf-gcc understands -c and -o together... yes checking for style of include used by make... GNU checking dependency style of arm-unknown-linux-gnueabihf-gcc... gcc3 checking how to run the C preprocessor... arm-unknown-linux-gnueabihf-gcc -E checking for arm-unknown-linux-gnueabihf-g++... arm-unknown-linux-gnueabihf-g++ checking whether we are using the GNU C++ compiler... yes checking whether arm-unknown-linux-gnueabihf-g++ accepts -g... yes checking dependency style of arm-unknown-linux-gnueabihf-g++... gcc3 checking for arm-unknown-linux-gnueabihf-ranlib... arm-unknown-linux-gnueabihf-ranlib checking for gcc-ranlib... /usr/bin/gcc-ranlib checking for a sed that does not truncate output... /bin/sed checking for ar... /usr/bin/ar checking for gcc-ar... /usr/bin/gcc-ar checking for perl... /usr/bin/perl checking for gdb... /usr/bin/gdb checking dependency style of arm-unknown-linux-gnueabihf-gcc... gcc3 checking for diff -u... yes checking for arm-unknown-linux-gnueabihf-gcc option to accept ISO C99... none needed checking for a supported version of gcc... ok (12.3.0) checking build system type... x86_64-unknown-linux-gnu checking host system type... arm-unknown-linux-gnueabihf checking for a supported CPU... no (arm) configure: error: Unsupported host architecture. Sorry
04-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值