Android ABIs dev guildlines for x86 & x86-64 looks like incorrect

439 views
Skip to first unread message

seal2002

unread,
Jul 28, 2023, 12:52:05 AM7/28/23
to android-ndk
Hello,

I compiled the curl libs for x86 and x86-64 following the instruction below


In those documents,  I added mtune=intel but when I do it, the compiler throws an error.

*  Executing task in folder Curl: E:/DevTools/FastBuild/FBuild.exe -j1 Curl-Debug-x86_64

1> Obj: E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj
1> Failed to build Object. Error: 1 (0x01) Target: 'E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj'
1> PROBLEM: E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj
error: unknown target CPU 'intel'
note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geode
FBuild: Error: BUILD FAILED: Curl-Debug-x86_64
Time: 0.054s

 *  The terminal process "E:\DevTools\FastBuild\FBuild.exe '-j1', 'Curl-Debug-x86_64'" terminated with exit code: 4294967295.
 *  Press any key to close the terminal. 

I search around the clang and gcc instructions, mtune=intel does not mention anywhere.
My project uses:
android ndk 25c
host: windows
Thanks

Rich Schmitt

unread,
Jul 28, 2023, 11:34:23 AM7/28/23
to andro...@googlegroups.com

The ABIs I use are:

“x86_64”

“x86”

“arm64-v8a”

“armeabi-v7a”

 

 

 

--
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/6ee83b89-7c1f-43d6-a6a5-78a8c751e199n%40googlegroups.com.

enh

unread,
Jul 28, 2023, 11:45:28 AM7/28/23
to andro...@googlegroups.com
On Thu, Jul 27, 2023 at 9:52 PM seal2002 <phann...@gmail.com> wrote:
Hello,

I compiled the curl libs for x86 and x86-64 following the instruction below


In those documents,  I added mtune=intel but when I do it, the compiler throws an error.

that's not what the doc means. you shouldn't do anything --- just use the NDK's clang with an Android --target=, and it'll chose the right options for you. this (confusing) doc was just trying to give you an idea of what those options are behind the scenes. i almost deleted it last time i touched this doc because i thought it was more confusing than helpful. thank you for proving that to be true for actual developers! i'll try to go through today and clean up the x86/x86-64 bits.
 
*  Executing task in folder Curl: E:/DevTools/FastBuild/FBuild.exe -j1 Curl-Debug-x86_64

1> Obj: E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj
1> Failed to build Object. Error: 1 (0x01) Target: 'E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj'
1> PROBLEM: E:\Sampleslibs\Curl\prj\android_fastbuild\obj\x86_64\Debug\vtls\sectransp.obj
error: unknown target CPU 'intel'
note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geode
FBuild: Error: BUILD FAILED: Curl-Debug-x86_64
Time: 0.054s

 *  The terminal process "E:\DevTools\FastBuild\FBuild.exe '-j1', 'Curl-Debug-x86_64'" terminated with exit code: 4294967295.
 *  Press any key to close the terminal. 

I search around the clang and gcc instructions, mtune=intel does not mention anywhere.
My project uses:
android ndk 25c
host: windows
Thanks

enh

unread,
Jul 28, 2023, 12:06:13 PM7/28/23
to andro...@googlegroups.com
(btw, if you just want to use curl, you should probably be looking at https://android-developers.googleblog.com/2020/02/native-dependencies-in-android-studio-40.html instead...)

Dan Albert

unread,
Jul 28, 2023, 5:29:13 PM7/28/23
to andro...@googlegroups.com
The sample is going to be more up to date than the blog post from 2020, of course :) https://github.com/android/ndk-samples/tree/main/prefab/curl-ssl

enh

unread,
Jul 28, 2023, 6:47:03 PM7/28/23
to andro...@googlegroups.com
On Fri, Jul 28, 2023 at 2:29 PM 'Dan Albert' via android-ndk <andro...@googlegroups.com> wrote:
The sample is going to be more up to date than the blog post from 2020, of course :) https://github.com/android/ndk-samples/tree/main/prefab/curl-ssl

gah, annoyingly _that_ wasn't on my first page of search results :-(

anyway, yeah, i've updated https://developer.android.com/ndk/guides/abis to not be so distracting. if you just want to _use_ curl, follow danalbert's link above (and maybe read the blog post for background :-) ). if you really do need to build it yourself for some reason, see https://developer.android.com/ndk/guides/other_build_systems for the full details.
 

seal2002

unread,
Jul 28, 2023, 11:29:08 PM7/28/23
to android-ndk
Thank you for your quick answer :+1:

yu...@unity3d.com

unread,
Jul 31, 2023, 1:28:01 AM7/31/23
to android-ndk
I used the CPU option few times. (not for intel targets - sorry somewhat offtopic)
It looks like clang defaults to Cortex-A9, so I thought maybe specifying something newer may produce a result more suited for out of order CPUs.
But, no. Only A75+ enabled the newer extensions (LSE etc).
So for me it appeared to be a very niche option.

enh

unread,
Jul 31, 2023, 2:09:40 PM7/31/23
to andro...@googlegroups.com
yeah, for NDK users (as opposed to folks building the OS itself) these
options probably aren't very useful at all --- you have no idea what
cpu you'll be _running_ on (people are still selling _new_ A53-based
devices in 2023), so you certainly can't rely on stuff like LSE[1]
being present[2]. as for the _scheduling_ side of things, well,
similar problem but with less disastrous results --- you have no idea
whether you'll be on an in-order or out-of-order core until runtime,
so telling the compiler to assume a specific core is even less
realistic :-(

(on the bright side, cortex-a9s should mostly be aged out of the
population by now!)

____
1. though in that special case, you might want to look at the "outline
atomics" option which generates both paths and chooses one at runtime:
https://reviews.llvm.org/D91157
2. this is the point of function multi-versioning (FMV), though afaik
that's still unfinished for arm64:
https://maskray.me/blog/2023-02-05-function-multi-versioning
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/d6be59bc-315e-41b0-992b-80f77ef80a1fn%40googlegroups.com.

yu...@unity3d.com

unread,
Aug 1, 2023, 6:25:30 AM8/1/23
to android-ndk
FMV for AArch64 is supported in NDK r26 beta 1. This is what Pavel, the developer of the feature, told me.

A53 is slow, but it's at least 64bit. But when new phones are using 32-bit Android OS on a 64-bit capable SoC... this is what makes me even more sad.

John Dallman

unread,
Aug 1, 2023, 7:28:59 AM8/1/23
to andro...@googlegroups.com
From experience in a different part of the software jungle, some vendors are just scared of 64-bit and come up with excuses to avoid it for years. Withdrawing support for the 32-bit OS is the only thing that will change this situation.

John  

enh

unread,
Aug 1, 2023, 1:25:21 PM8/1/23
to andro...@googlegroups.com
On Tue, Aug 1, 2023 at 3:25 AM 'yu...@unity3d.com' via android-ndk
<andro...@googlegroups.com> wrote:
>
> FMV for AArch64 is supported in NDK r26 beta 1. This is what Pavel, the developer of the feature, told me.

yeah, there's _something_ in there, but this is software, so it's
never done :-) more specifically, what's there atm will generate ifunc
resolvers that only work on versions of Android new enough to pass the
struct argument with multiple hwcaps. that may be sufficient for
_your_ purposes -- and _you_ are sophisticated enough to debug your
way out of any issues -- but it'll be a while before you'll hear me
making any general recommendations here. (but please let me know how
you get on if/when you try it... i'm always more confident
recommending things that i know people have used in practice [and
survived].)
> To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/29853465-556a-4ca7-9540-c904f59525can%40googlegroups.com.

seal2002

unread,
Nov 18, 2023, 12:07:17 AM11/18/23
to android-ndk
Yeah - I totally agreed with @yu
In the Android World, they have high-end devices with new SOC, and new instructions, ... but the remaining of them, we must deal with a lot of other mid-end, low-end SOC. Our Games are not only support for the high-end but also the mid-end and low-end.
In 2023, I still discovered so many 32-bit devices added to Google Play Console :(
I think we should target target compilers for mid-end such as A53 architectures. But I'm not sure it can make the high-end got trouble.
Reply all
Reply to author
Forward
0 new messages