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

Choose platform triplets for android builds #72104

Closed
doko42 opened this issue Aug 31, 2016 · 14 comments
Closed

Choose platform triplets for android builds #72104

doko42 opened this issue Aug 31, 2016 · 14 comments
Labels
build The build process and cross-build

Comments

@doko42
Copy link
Member

doko42 commented Aug 31, 2016

BPO 27917
Nosy @doko42, @pmp-p, @xdegaye, @yan12125
Files
  • android.diff: patch2
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-09-11.19:41:29.967>
    created_at = <Date 2016-08-31.17:23:02.013>
    labels = ['build']
    title = 'Choose platform triplets for android builds'
    updated_at = <Date 2020-11-19.05:30:08.247>
    user = 'https://github.com/doko42'

    bugs.python.org fields:

    activity = <Date 2020-11-19.05:30:08.247>
    actor = 'pmpp'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-09-11.19:41:29.967>
    closer = 'xdegaye'
    components = ['Build']
    creation = <Date 2016-08-31.17:23:02.013>
    creator = 'doko'
    dependencies = []
    files = ['44330']
    hgrepos = []
    issue_num = 27917
    keywords = ['patch']
    message_count = 14.0
    messages = ['274041', '274046', '274049', '274055', '274154', '274156', '274166', '274171', '274174', '274176', '274177', '274178', '275838', '275839']
    nosy_count = 5.0
    nosy_names = ['doko', 'pmpp', 'xdegaye', 'python-dev', 'yan12125']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue27917'
    versions = []

    @doko42
    Copy link
    Member Author

    doko42 commented Aug 31, 2016

    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.

    @doko42 doko42 added the build The build process and cross-build label Aug 31, 2016
    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Aug 31, 2016

    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.

    @doko42
    Copy link
    Member Author

    doko42 commented Aug 31, 2016

    hmm, should the android api level be part of the platform triplet? or are these not relevant for modules?

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Aug 31, 2016

    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.

    @doko42
    Copy link
    Member Author

    doko42 commented Sep 1, 2016

    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.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Sep 1, 2016

    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.

    @doko42
    Copy link
    Member Author

    doko42 commented Sep 1, 2016

    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?

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Sep 1, 2016

    CPython builds fine for MIPS with this patch. For MIPS64, apparently Android NDK is broken - it can't even compile a simple C file.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Sep 1, 2016

    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.

    @doko42
    Copy link
    Member Author

    doko42 commented Sep 1, 2016

    I think that's good for now. The compiler checks maybe can be later adjusted.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 1, 2016

    New changeset a931fdc4c4c4 by doko in branch 'default':

    @doko42
    Copy link
    Member Author

    doko42 commented Sep 1, 2016

    checked in.

    @doko42 doko42 closed this as completed Sep 1, 2016
    @xdegaye
    Copy link
    Mannequin

    xdegaye mannequin commented Sep 11, 2016

    test_triplet_in_ext_suffix in test_sysconfig fails with the 'x86' Android platform.

    @xdegaye xdegaye mannequin reopened this Sep 11, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 11, 2016

    New changeset 676e6c3d30db by Xavier de Gaye in branch 'default':
    Issue bpo-27917: Fix test_triplet_in_ext_suffix for the 'x86' Android platform.
    https://hg.python.org/cpython/rev/676e6c3d30db

    @xdegaye xdegaye mannequin closed this as completed Sep 11, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant