Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M1 support in ndk-build script #1410

Closed
Tracked by #1299
JancyWeng opened this issue Dec 25, 2020 · 13 comments
Closed
Tracked by #1299

M1 support in ndk-build script #1410

JancyWeng opened this issue Dec 25, 2020 · 13 comments
Assignees
Projects

Comments

@JancyWeng
Copy link

在Mac M1上使用NDK

export NDK_HOME=/Users/xxx/Library/Android/ndk/android-ndk-r22
export PATH=$NDK_HOME:$PATH

然后运行 ndk-build 的时候报错 ERROR: Unknown host CPU architecture: arm64

是否是不支持Mac M1?

@hhb
Copy link
Collaborator

hhb commented Dec 30, 2020

M1 native support is not ready yet. See #1299. In the mean time you can try to run ndk-build with rosetta2 like: arch -x86_64 /bin/bash -c ndk-build

@hhb hhb closed this as completed Dec 30, 2020
@muhammadatifarif
Copy link

error when building with ndkBuild using /Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/Android.mk: Build command failed.
Error while executing process /Users/mac/Library/Android/sdk/ndk/21.4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/Android.mk APP_ABI=x86 NDK_ALL_ABIS=x86 NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/build/intermediates/ndkBuild/debug/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
ERROR: Unknown host CPU architecture: arm64
Affected Modules: jnidictionaryv2

@hhb how to resolve this issue.?

@DanAlbert
Copy link
Member

Did you try using Rosetta?

@muhammadatifarif
Copy link

no rosetta for android studio.

@DanAlbert
Copy link
Member

Rosetta is something you install yourself. It's part of macOS, not Studio.

@rprichard rprichard reopened this Oct 13, 2021
@rprichard rprichard self-assigned this Oct 13, 2021
@rprichard rprichard changed the title Mac M1 ERROR: Unknown host CPU architecture: arm64 M1 support in ndk-build script Oct 13, 2021
@rprichard
Copy link
Collaborator

Fix uploaded: https://android-review.googlesource.com/c/platform/ndk/+/1855814

@DanAlbert
Copy link
Member

You will still need rosetta for ndk-build for a little while longer as many of the components listed in #1299 still need fat binaries, but that fix will resolve an ndk-build issue with rosetta. Plan is to have everything in the NDK be fixed to not require rosetta by the time r24 reaches stable (and a lot will be backported to r23).

@DanAlbert DanAlbert added this to Triaged in r24 via automation Oct 13, 2021
@DanAlbert DanAlbert added this to Triaged in r23c via automation Oct 13, 2021
@rprichard
Copy link
Collaborator

You will still need rosetta for ndk-build for a little while longer as many of the components listed in #1299 still need fat binaries, but that fix will resolve an ndk-build issue with rosetta. Plan is to have everything in the NDK be fixed to not require rosetta by the time r24 reaches stable (and a lot will be backported to r23).

For the upcoming r24, we currently have these components as universal binaries: LLVM, make, python3, and shader-tools. The NDK package still needs yasm and simpleperf migrated. CMake and Ninja are shipped independently of the NDK, and they're in progress. (I have them building as universal binaries already, but we need to upgrade the CMake version in the SDK.)

@muhammadatifarif
Copy link

issue is resolved just changed ndk-build script mentioned in answer https://stackoverflow.com/questions/69541831/unknown-host-cpu-architecture-arm64-android-ndk-siliconm1-apple-macbook-pro

@DanAlbert DanAlbert moved this from Triaged to Needs cherry-pick in r23c Nov 10, 2021
@DanAlbert DanAlbert moved this from Triaged to Needs cherry-pick in r24 Nov 10, 2021
@DanAlbert DanAlbert moved this from Needs cherry-pick to Merged in r24 Dec 15, 2021
@qpqg

This comment was marked as off-topic.

@DanAlbert

This comment was marked as off-topic.

@rprichard

This comment was marked as off-topic.

@DanAlbert
Copy link
Member

Should be fixed in r23 build 8486889.

r23c automation moved this from Needs cherry-pick to Merged Apr 22, 2022
MaoHan001 pushed a commit to riscv-android-src/platform-ndk that referenced this issue Jun 22, 2022
Also: Remove the special logic for 32-bit x86 on Linux, Darwin, and
Windows. The NDK doesn't support any 32-bit hosts anymore.

Bug: android/ndk#1410
Test: python3 ./checkbuild.py on M1 macOS
  (make sure the python3 runs as arm64. It will run /bin/bash as arm64,
  then `uname -m` as arm64.)
Change-Id: If6588b61c74779016a22dc6cada814cd4c6a77f5
(cherry picked from commit b542853)
Merged-In: If6588b61c74779016a22dc6cada814cd4c6a77f5
MaoHan001 pushed a commit to riscv-android-src/platform-ndk that referenced this issue Jun 22, 2022
Bug: android/ndk#1410
Test: None
Change-Id: Ib315e3a85b3e952ecb7cea8d2351af2f841d8cce
(cherry picked from commit a27f773c17e18c41f8075abb06f7bbd35dcb2d3b)
Merged-In: Ib315e3a85b3e952ecb7cea8d2351af2f841d8cce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
r23c
  
Merged
r24
  
Merged
Development

No branches or pull requests

6 participants