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 — Add android cross compiling support by jcfr · Pull Request #321 · python-cmake-buildsystem/python-cmake-buildsystem

Conversation

@jcfr

@jcfr jcfr commented Jan 26, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This corresponds to #280 being rebased against current master (along with extracting documentation into its own CROSS-COMPILING.rst document)

  • Test
  • Consolidate changes proposed here with the one originally suggested by @o01eg in Initial Android support #262
  • Add continuous integration (possibly by leveraging dockcross 1

Footnotes

  1. https://github.com/dockcross/dockcross#readme ↩

Sorry, something went wrong.

Uh oh!

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

Efreak reacted with eyes emoji
All reactions
  • 👀 1 reaction
@jcfr

jcfr commented Jan 26, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

@iyadahmed When (and if) you have the bandwidth, let us know what you think 🙏

Alternatively if time is limited, there is no problem integrating the patch originally suggested in #320 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

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

@jcfr jcfr added the Project: crosscompilation crosscompilation specific label Jan 26, 2023
@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

I've just tried it, it works great, but it still does not execute the cmTC_* executables in a virtual device automatically, but not a problem, it can be done in a separate patch, also I was going to execute them manually anyways, I think this patch is good to go so far
@jcfr

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023

Copy link
Copy Markdown

Here are the results of the binaries on an Android 5.0 arm64 virtual device, I think all of them succeeded except two
image

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

Yep here are exit codes for each program, there's two extra programs that turned out to not return 0
image

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023

Copy link
Copy Markdown

here's the configure command I'm using btw

cmake .. \
-D_download_3.10.9_md5="25eb3686327c157dcb8ac9f01105c306" \
-DPYTHON_VERSION=3.10.9 \
-DCMAKE_INSTALL_PREFIX=/home/iyad/Development/Blender_On_Android/lib/android_aarch64/python \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=/home/iyad/Android/Sdk/ndk/25.1.8937393 \
-DCMAKE_ANDROID_STL_TYPE=c++_static
make install
All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

tests are failing on mac though :/ @jcfr
Let's integrate the other patch instead as it succeeds on MacOS according to CI

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023

Copy link
Copy Markdown

for some reason this patch produces different check binaries than master

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023

Copy link
Copy Markdown

Here are results of cmTC_* binaries from the other patch
image

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

the second run of my patch after inputting return codes outputs more binaries

cmake .. \
-D_download_3.10.9_md5="25eb3686327c157dcb8ac9f01105c306" \
-DPYTHON_VERSION=3.10.9 \
-DCMAKE_INSTALL_PREFIX=/home/iyad/Development/Blender_On_Android/lib/android_aarch64/python \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=/home/iyad/Android/Sdk/ndk/25.1.8937393 \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DDOUBLE_IS_BIG_ENDIAN_IEEE754=0 \
-DDOUBLE_IS_LITTLE_ENDIAN_IEEE754=0 \
-DPLATFORM_RUN=0 \
-DPLATFORM_RUN__TRYRUN_OUTPUT="aarch64-linux-gnu" \
-DDOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754=0 \
-DHAVE_BROKEN_NICE_EXITCODE=0 \
-DHAVE_BROKEN_POLL_EXITCODE=0 \
-DHAVE_MMAP_DEV_ZERO_EXITCODE=0

so I guess this patch has more fixes for Android, but it breaks MacOSX

returns codes and std output of those newly generated cmTC_* binaries
image

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

ah for automatic running on virtual device my bad I should have used the instructions from unix docs,
still this CI macos failing hmm

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

The run_on_android.sh script works great! got Python on the virtual device!
image

now we need to figure out why MacOSX CI fails 😄

All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023

Copy link
Copy Markdown

here's my final config command, now using the default Python version as Python 3.10 fails for some reason

cmake .. \
-DCMAKE_INSTALL_PREFIX=/home/iyad/Development/Blender_On_Android/lib/android_aarch64/python \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=/home/iyad/Android/Sdk/ndk/25.1.8937393 \
-DCMAKE_ANDROID_STL_TYPE=c++_static \
-DCMAKE_CROSSCOMPILING_EMULATOR=../run_on_android.sh \
-DANDROID_ALLOW_UNDEFINED_SYMBOLS=ON \
-DENABLE_DECIMAL=OFF \
-DENABLE_CTYPES=OFF
All reactions

Sorry, something went wrong.

Uh oh!

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

@ghost

ghost commented Jan 27, 2023 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

Things are becoming more clear now, imo,

  • We should not rely on CMAKE_CXX_COMPILER_ID MATCHES "Clang" let's use APPLE OR ANDROID instead, hopefully this fixes the MacOSX CI
  • Let's also use ANDROID instead of ${CMAKE_SYSTEM_NAME} MATCHES "^Android" for sake of consistency and robustness

@jcfr

All reactions

Sorry, something went wrong.

Uh oh!

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

@jcfr
jcfr force-pushed the add-android-cross-compiling-support branch from bf53a65 to 7a07b4d Compare June 28, 2023 22:52
@jcfr jcfr mentioned this pull request Jun 28, 2023
Android #323
Closed
This was linked to issues Jun 28, 2023
Compile Python for Android? #253
Open
Android Cross-compilation. #158
Open
o01eg and others added 9 commits June 28, 2023 19:06
@o01eg @jcfr
Start initial Android support
20333aa
@o01eg @jcfr
Don't try to call python in Adroid cross-compilation
579232d
Victor Paleologue @jcfr
Fix disabling the compilation of decimal
49152b1
It was not effective, and it was visible using Android Studio.
Victor Paleologue @jcfr
Integrate the script for running executables on Android targets
11bbbe2
Victor Paleologue @jcfr
Fix floating point endianness checks
31eb5db
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 @jcfr
On Android, use variables to deduce target platform's triple
b661d34
It avoids the need for checking it by running a program on the target
platform.
Victor Paleologue @jcfr
Do not regenerate importlib.h and importlib_external.h when cross-com…
3a9d6d5
…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.
Iyad Ahmed @jcfr
Disable looking for libutil on Android
fbbbd98
Iyad Ahmed @jcfr
Refactor Android related CMake configuration
6b3e42d
@jcfr
jcfr force-pushed the add-android-cross-compiling-support branch from 6d0d7c1 to 6b3e42d Compare June 28, 2023 23:06
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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Compile Python for Android? Android Cross-compilation.

Uh oh!

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

2 participants

@jcfr @o01eg
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.