FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add android cross compiling support by jcfr · Pull Request #321 · python-cmake-buildsystem/python-cmake-buildsystem · GitHub

Add android cross compiling support - #321

Open
jcfr wants to merge 9 commits into
python-cmake-buildsystem:masterfrom
jcfr:add-android-cross-compiling-support
Open

Add android cross compiling support#321
jcfr wants to merge 9 commits into
python-cmake-buildsystem:masterfrom
jcfr:add-android-cross-compiling-support

Conversation

jcfr commented Jan 26, 2023
edited
Loading

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

jcfr commented Jan 26, 2023
edited
Loading

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)

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

ghost commented Jan 27, 2023
edited by ghost
Loading

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

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

ghost commented Jan 27, 2023
edited by ghost
Loading

Copy link
Copy Markdown

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

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

ghost commented Jan 27, 2023
edited by ghost
Loading

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

ghost commented Jan 27, 2023

Copy link
Copy Markdown

for some reason this patch produces different check binaries than master

ghost commented Jan 27, 2023

Copy link
Copy Markdown

Here are results of cmTC_* binaries from the other patch

ghost commented Jan 27, 2023
edited by ghost
Loading

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

ghost commented Jan 27, 2023
edited by ghost
Loading

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

ghost commented Jan 27, 2023
edited by ghost
Loading

Copy link
Copy Markdown

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

now we need to figure out why MacOSX CI fails 😄

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

ghost commented Jan 27, 2023
edited by ghost
Loading

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

jcfr force-pushed the add-android-cross-compiling-support branch from bf53a65 to 7a07b4d Compare June 28, 2023 22:52
jcfr mentioned this pull request Jun 28, 2023
This was linked to issues Jun 28, 2023
o01eg and others added 9 commits June 28, 2023 19:06
It was not effective, and it was visible using Android Studio.
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.
It avoids the need for checking it by running a program on the target
platform.
…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.
jcfr force-pushed the add-android-cross-compiling-support branch from 6d0d7c1 to 6b3e42d Compare June 28, 2023 23:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Project: crosscompilation crosscompilation specific

Development

Successfully merging this pull request may close these issues.

Compile Python for Android? Android Cross-compilation.

2 participants


Back | FazBrowse Home | New Git URL