GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Initial Android Support: alternate by victorpaleologue · Pull Request #280 · python-cmake-buildsystem/python-cmake-buildsystem

Conversation

@victorpaleologue

@victorpaleologue victorpaleologue commented May 26, 2021

Copy link
Copy Markdown

Hello,
I have been using the branch by @o01eg to build Python for Android (from this PR: #262) and managed to make it work with some extra changes.
I hope this set of changes will be interesting as well.

To avoid requiring to connect to a target device while building (which is hard to achieve on simpler buildfarms), I had to provide certain definitions manually. I tested the build with the following definitions:

"-DBUILD_EXTENSIONS_AS_BUILTIN=ON", // Have the extensions built in the Python library.
"-DANDROID_ALLOW_UNDEFINED_SYMBOLS=ON", // Required because of how Python builds its extensions.

// Remove content or features we do not need.
"-DINSTALL_MANUAL=OFF",
"-DINSTALL_TEST=OFF",
"-DINSTALL_DEVELOPMENT=OFF",
"-DWITH_DOC_STRINGS=OFF",

// Disable some Python extensions that are not supported.
"-DENABLE_CTYPES=OFF",
"-DENABLE_DECIMAL=OFF",
"-DENABLE_GRP=OFF",

// KLUDGE: assuming some properties of the target platform to avoid running
// programs on a target device to deduce them.
"-DX87_DOUBLE_ROUNDING=OFF",
"-DTANH_PRESERVES_ZERO_SIGN=ON",
"-DLOG1P_DROPS_ZERO_SIGN=ON",
"-DPOSIX_SEMAPHORES_NOT_ENABLED=OFF",
"-DHAVE_BROKEN_SEM_GETVALUE=OFF",
"-DHAVE_BROKEN_NICE=OFF",
"-DHAVE_BROKEN_POLL=OFF",
"-DHAVE_WORKING_TZSET=ON",
"-DHAVE_ALIGNED_REQUIRED=ON",
"-DHAVE_BROKEN_MBSTOWCS=OFF",
"-DHAVE_COMPUTED_GOTOS=OFF",
"-DHAVE_GLIBC_MEMMOVE_BUG=OFF",
"-DHAVE_LONG_LONG_FORMAT=OFF",
"-DHAVE_SIZE_T_FORMAT=OFF",

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
o01eg and others added 7 commits May 25, 2021 16:50
@o01eg Victor Paleologue
Start initial Android support
5af4cba
@o01eg Victor Paleologue
Don't try to call python in Adroid cross-compilation
34fb558
Victor Paleologue
Fix disabling the compilation of decimal
62bfb1c
It was not effective, and it was visible using Android Studio.
Victor Paleologue
Integrate the script for running executables on Android targets
b5514c5
Victor Paleologue
Fix floating point endianness checks
bd22c78
Translated to CMake from a patch on the Yocto project:
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3/0002-Don-t-do-runtime-test-to-get-float-byte-order.patch?h=zeus
It avoids the execution of a program on the target device,
and produces a clearer endianness result.
Victor Paleologue
On Android, use variables to deduce target platform's triple
db5aae1
It avoids the need for checking it by running a program on the target
platform.
Victor Paleologue
Do not regenerate importlib.h and importlib_external.h when cross-com…
fdea12e
…piling

They are already present in source releases, so it is possible to ignore
the regeneration step. We do that only when cross-compiling, because it
is not possible to build for both the host and the target with a single
pass of CMake.
@o01eg

o01eg commented Oct 13, 2021

Copy link
Copy Markdown

Nice, I'll try it later, but Fix floating point endianness checks helped to fix them on Github Actions Android emulator. Locally I got:

-- Checking for x64 gcc inline assembler
-- Checking for x64 gcc inline assembler - yes
-- Checking whether C doubles are little-endian IEEE 754 binary64
-- Checking whether C doubles are little-endian IEEE 754 binary64 - yes
-- Checking whether C doubles are big-endian IEEE 754 binary64
-- Checking whether C doubles are big-endian IEEE 754 binary64 - no
-- Checking doubles are ARM mixed-endian IEEE 754 binary64
-- Checking doubles are ARM mixed-endian IEEE 754 binary64 - no
-- Checking whether we can use gcc inline assembler to get and set x87 control word
-- Checking whether we can use gcc inline assembler to get and set x87 control word - yes

But in Github Actions I got:

-- Checking for x64 gcc inline assembler
-- Checking for x64 gcc inline assembler - yes
-- Checking whether C doubles are little-endian IEEE 754 binary64
-- Checking whether C doubles are little-endian IEEE 754 binary64 - yes
-- Checking whether C doubles are big-endian IEEE 754 binary64
-- Checking whether C doubles are big-endian IEEE 754 binary64 - yes
-- Checking doubles are ARM mixed-endian IEEE 754 binary64
-- Checking doubles are ARM mixed-endian IEEE 754 binary64 - yes
-- Checking whether we can use gcc inline assembler to get and set x87 control word
-- Checking whether we can use gcc inline assembler to get and set x87 control word - yes
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jcfr

jcfr commented Dec 27, 2021

Copy link
Copy Markdown
Contributor

@victorpaleologue Thanks for working on the Android support 🙏 and thanks @o01eg for reviewing.

Working on the backlog of pull request, is there anything else from #262 that we should add here ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jcfr jcfr added Project: crosscompilation crosscompilation specific Type: Enhancement Improvement to functionality labels Dec 27, 2021
@o01eg

o01eg commented Dec 27, 2021

Copy link
Copy Markdown

@jcfr I suppose it could be useful to add Github Actions CI build here at least.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jan 26, 2023
Disable looking for libutil on Android #320
Closed
Add android cross compiling support #321
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Project: crosscompilation crosscompilation specific Type: Enhancement Improvement to functionality

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@victorpaleologue @o01eg @jcfr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.