Skip to content

Add Android wheels - #289

Merged
mattip merged 9 commits into
MacPython:mainfrom
mhsmith:android
Nov 2, 2026
Merged

mattip merged 9 commits into
MacPython:mainfrom
mhsmith:android

Conversation

@mhsmith

@mhsmith mhsmith commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

The main purpose of this PR is to allow using scipy-openblas wheels to build NumPy for Android (numpy/numpy#33194).

General comments:

  • This is the first cross-compiled target in this repository. To support this, anywhere that used uname to identify the OS has been replaced with MB_ML_LIBC, which is ultimately derived from CIBUILDWHEEL_BUILD_IDENTIFIER.

  • Since we're no longer necessarily compiling for the build machine, BUILD_PREFIX has been changed from /usr/local to a temporary subdirectory of build, also derived from CIBUILDWHEEL_BUILD_IDENTIFIER.

  • Since the OpenBLAS library can't be loaded on the build machine when cross-compiling, I've changed the get_pkg_config function to read the openblas_config and version number from the existing .pc file. This approach also works when compiling NumPy (see its PR linked above).

  • Unlike the build script, the test script is run on an emulator, so it can load the library and print its configuration.

  • I updated the package version in pyproject.toml and made sure the first 3 numbers match ./openblas_commit.txt. If I did not update ./openblas_commit.txt, I incremented the wheel build number (i.e. 0.3.29.0.0 to 0.3.29.0.1)

@mattip

mattip commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Is android well supported in upstream OpenBLAS?

Comment thread tools/build_steps.sh
fi
# get_macpython_environment ${MB_PYTHON_VERSION} venv
python3.9 -m venv venv
source venv/bin/activate

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This environment wasn't used anywhere.

Comment thread tools/build_steps.sh
Comment on lines -84 to -86
function get_plat_tag {
# Copied from gfortran-install/gfortran_utils.sh, modified for MB_ML_LIBC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When reviewing references to uname and the MB_ML_ variables, I found the output of this function wasn't used anywhere.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there are a lot of loose ends in this repo, the code goes back before cibuildwheel ...

Comment thread ci-test.sh
@@ -1,16 +1,9 @@
#!/bin/bash
# Test that the wheel works with a different python

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment was ever true: the build and test previously both used Python 3.9, and now they're using Python 3.13.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once upon a time we built the wheel with 3.9 and tested with 3.11, but the move to 3.13 kind of messed that all up.

Comment thread ci-test.sh
Comment on lines -5 to -6
if [ "${PLAT}" == "arm64" ]; then
# Cannot test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was a leftover from when GitHub Actions didn't have ARM64 runners, because it works fine now.

@mhsmith

mhsmith commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Is android well supported in upstream OpenBLAS?

Yes, and it's been used on Android for many years in apps based on Chaquopy and Kivy.

This PR is now ready for review.

@mhsmith
mhsmith marked this pull request as ready for review November 1, 2026 18:21
@mattip
mattip merged commit 1ba7b74 into MacPython:main Nov 2, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants