NDK for ARM Linux?

1,284 views
Skip to first unread message

John Dallman

unread,
Dec 23, 2021, 8:00:29 AM12/23/21
to andro...@googlegroups.com
Preface: I am not producing an Android app. I work for a software component business, creating shared libraries, compiled from C and C++ code, for use in third-party customers' apps. I test my libraries in a command-line test harness, which I run in the ADB shell. 

I've found that I can get my Android command-line test harness, built with NDK 21b, to run on ARM Linux. If people are interested in the details, I can post them. 

However, I need to build my Android code on x86 (I'm using the Linux version of the NDK), because there isn't a version of the NDK for ARM Linux. Is there any prospect of it appearing? If so, it would be convenient for me if the NDK ran on glibc 2.26 or earlier, since that's my standard for ARM Linux. 

Compliments of the season,

John Dallman

Thanks, 

John Dallman

Luiz Valdetaro

unread,
Dec 23, 2021, 8:34:37 AM12/23/21
to andro...@googlegroups.com
I'm not sure about ARM Linux, but ARM MacOS should be here soon, since Android Studio already supports the M1 chip. I think is not a big stretch , since google also supports AS for the Chrome OS, and a lot of Chromebooks are ARM.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAH1xqgnhw9TwbFBJ47%3DhO%2BvgRuKOFxC5daavf-1QwJFMoMcxKg%40mail.gmail.com.

Andrew Esh

unread,
Dec 23, 2021, 9:07:08 AM12/23/21
to andro...@googlegroups.com
Why would you need to build on ARM? The NDK is designed for cross compiling. Because of that, the developers of the NDK can focus all the tools on running on x86_64, and cross compile with them for whatever architecture is required by the target device. The only reason I can see for creating and releasing an ARM NDK is if ARM development platforms became more popular than x86_64. At present, ARM Is less popular than x86_64.

Since the target device is always going to have a chance of having a different architecture than the development device, the NDK is always going to be cross-compiling. Having good cross compiling skills is the best solution to the problem, not trying to match development and target architectures. If the architectures had to match, then there would have to be a different NDK for each combination of architectures. That doesn't scale, to the point of absurdity. Even if ARM development platforms became more popular, the NDK would still have to cross compile to target any platform that is not ARM.

Luiz Valdetaro

unread,
Dec 23, 2021, 9:13:12 AM12/23/21
to andro...@googlegroups.com
The original poster stated he has to test on ARM, so compiling in x86_64 are a burdensome step for him.

For Android development on Macs (the most popular hardware for android development), the M1 chip surpasses X86_64 in performance. I have been testing it and I'm very impressed. There are issues. 1- you can really only use the ARM64 emulator. 2-no NDK as of yet. 

Arm is already here, it is a matter of time, it will become the most popular. Speed counts.

John Dallman

unread,
Dec 23, 2021, 10:03:45 AM12/23/21
to andro...@googlegroups.com
> The original poster stated he has to test on ARM, so compiling in x86_64 are a burdensome step for him.

Yup, it is awkward. Not fatal, just awkward. I am only supporting 64-bit ARM with the Android libraries (not apps) that I produce. 32-bit ARM can't handle enough memory to be useful. 


> For Android development on Macs (the most popular hardware for android development), the M1 chip 
> surpasses X86_64 in performance. I have been testing it and I'm very impressed. There are issues. 
> 1- you can really only use the ARM64 emulator. 2-no NDK as of yet. 

It is indeed very fast. I produce the same libraries for ARM64 MacOS, x86-64 MacOS, and iOS. But I'm also producing ARM64 Linux and x86-64 Linux. I've found I can run ARM64 Android binaries directly on ARM64 Linux, without an emulator, which is more convenient than running them on an Android device. 

John


Dan Albert

unread,
Jan 4, 2022, 7:17:58 PM1/4/22
to android-ndk
It's not a thing on our roadmap. Adding (and continuously testing) a new host configuration is a fair amount of work and arm Linux as far as we can tell would be a very small user base (very likely to be less than x86_64 Linux, which is already minimal compared to Windows and macOS). Maybe some day, but it's not something we can spare people for right now.

If you're feeling ambitious you could try building the NDK (and its dependencies) for that OS yourself. We'd most likely accept patches to support it, I just don't want to ship something that we're not able to test. https://android.googlesource.com/platform/ndk/+/master/docs/Onboarding.md would be the place to start, but note that most of that project is actually prebuilt artifacts, so you'd need to fix the upstream builds like LLVM first and then integrate those into the NDK's build.

We do *our* arm testing on devices, fwiw. We have a handful of devices attached to our workstations and our test runner shards the tests across them. We of course are very interested in making sure those binaries work on Android specifically and not just on arm, so it's not quite the same use case :)

John Dallman

unread,
Jan 5, 2022, 10:55:13 AM1/5/22
to andro...@googlegroups.com
> >  I've found that I can get my Android command-line test harness, built with NDK 21b, 
> > to run on ARM Linux. If people are interested in the details, I can post them. 
> It's not a thing on our roadmap. Adding (and continuously testing) a new host configuration 
> is a fair amount of work and arm Linux as far as we can tell would be a very small user base 

Perfectly reasonable. 

> If you're feeling ambitious you could try building the NDK (and its dependencies) for that 
> OS yourself. 

Not that ambitious. I'd be able to produce a method for passing testing jobs from Linux x86-64 to Linux ARM with far less work. 

> I just don't want to ship something that we're not able to test.

I'm very happy about that!

> We do *our* arm testing on devices, fwiw.

I would have to keep that capability and use it regularly anyway, because the libraries have to run on Android. It's just that running devices flat out for 16 hours a day tends to result in bulged batteries after a year or two. 

Thanks very much,

John

Reply all
Reply to author
Forward
0 new messages