classification
Title: Choose platform triplets for android builds
Type: Stage:
Components: Build Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doko, python-dev, xdegaye, yan12125
Priority: normal Keywords: patch

Created on 2016-08-31 17:23 by doko, last changed 2016-09-11 19:41 by xdegaye. This issue is now closed.

Files
File name Uploaded Description Edit
android.diff doko, 2016-09-01 18:40 patch2 review
Messages (14)
msg274041 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-08-31 17:23
Following up to http://bugs.python.org/issue23968, I think we should choose different platform triplets for the android builds than we do for the linux builds.  Not sure which ones.

I saw the following gnu triplets used:

 - i686-linux-android
 - arm-linux-androidabi

Looking at the two cross compilers from the Ubuntu archive, I see that the arm compiler defines a __ANDROID__ macro, while the i686 compiler doesn't, so it might be difficult to select the correct platform triplet.

Could somebody check different compilers (clang as well) to see if this macro is defined?

<gcc|clang>  -E -dM - < /dev/null|grep -i android

Not sure which architectures else should be defined, but aarch64 comes to my mind as well.
msg274046 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2016-08-31 17:44
In changeset 46567fda0b29, Xavier defined an autotools variable $ANDROID_API_LEVEL. This can be used to determine whether a specific compiler targets Android or not.
msg274049 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-08-31 17:59
hmm, should the android api level be part of the platform triplet? or are these not relevant for modules?
msg274055 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2016-08-31 18:14
In Android NDK, each API level comes with a different set of header files ($ANDROID_NDK/platforms/android-$ANDROID_API_LEVEL/arch-$ARCH/usr/include). In a strict sense, the API level should be included in platform triplet. At least the plat-* directory has different contents in different API levels. In practical, I haven't seen such a usage.
msg274154 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-09-01 17:06
here's a patch, not yet including the ABI levels. I think we didn't need them for Linux, and maybe start for Android without using them. You can later introduce these if you have to.
msg274156 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2016-09-01 17:48
Well, here's a list of cross compilers in Android NDK:

$ ls $ANDROID_NDK/toolchains/*/prebuilt/*/bin/*-gcc | xargs -i basename '{}'     
aarch64-linux-android-gcc
arm-linux-androideabi-gcc
mips64el-linux-android-gcc
mipsel-linux-android-gcc
i686-linux-android-gcc
x86_64-linux-android-gcc

Does Python's platform triplet have the same meaning as GCC's --target? If so those names can be used.

By the way, +1 for not including the API level.
msg274166 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-09-01 18:40
yes, it should follow the gnu triplets. I updated these, and added some for mips. However I can't check if the mips ones will do what they are supposed to do. Please could you check these if you have cross compilers available?
msg274171 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2016-09-01 19:25
CPython builds fine for MIPS with this patch. For MIPS64, apparently Android NDK is broken - it can't even compile a simple C file.
msg274174 - (view) Author: Chih-Hsuan Yen (yan12125) * Date: 2016-09-01 19:42
OK found some wrong usages in my build script. Now MIPS64 builds fine, and PLATFORM_TRIPLET is detected as intended. I didn't test the build on actual devices, as I don't have a MIPS or MIPS64 device.
msg274176 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-09-01 20:02
I think that's good for now. The compiler checks maybe can be later adjusted.
msg274177 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-01 20:05
New changeset a931fdc4c4c4 by doko in branch 'default':
- Issue #27917: Set platform triplets for Android builds.
https://hg.python.org/cpython/rev/a931fdc4c4c4
msg274178 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2016-09-01 20:06
checked in.
msg275838 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-09-11 19:38
test_triplet_in_ext_suffix in test_sysconfig fails with the 'x86' Android platform.
msg275839 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-11 19:40
New changeset 676e6c3d30db by Xavier de Gaye in branch 'default':
Issue #27917: Fix test_triplet_in_ext_suffix for the 'x86' Android platform.
https://hg.python.org/cpython/rev/676e6c3d30db
History
Date User Action Args
2016-09-11 19:41:29xdegayesetstatus: open -> closed
2016-09-11 19:40:11python-devsetmessages: + msg275839
2016-09-11 19:38:22xdegayesetstatus: closed -> open

messages: + msg275838
2016-09-01 20:06:07dokosetstatus: open -> closed
resolution: fixed
messages: + msg274178
2016-09-01 20:05:32python-devsetnosy: + python-dev
messages: + msg274177
2016-09-01 20:02:22dokosetmessages: + msg274176
2016-09-01 19:42:44yan12125setmessages: + msg274174
2016-09-01 19:25:58yan12125setmessages: + msg274171
2016-09-01 18:41:15dokosetfiles: - android.diff
2016-09-01 18:40:43dokosetfiles: + android.diff

messages: + msg274166
2016-09-01 17:48:54yan12125setmessages: + msg274156
2016-09-01 17:06:26dokosetfiles: + android.diff
keywords: + patch
messages: + msg274154
2016-08-31 18:14:29yan12125setmessages: + msg274055
2016-08-31 17:59:05dokosetmessages: + msg274049
2016-08-31 17:44:44yan12125setnosy: + xdegaye
messages: + msg274046
2016-08-31 17:25:07dokosetnosy: + yan12125
2016-08-31 17:23:02dokocreate