Now that I successfully built my module for windows, it fails with Numpy import_array init macro, I'm considering switching to Python Buffer Protocol https://docs.python.org/3/c-api/buffer.html is there anything available in shiboken to support this? (didn't find anything)
after trying number of times i decided to run the cross compiling tool with -occp flag, which i hoped would cross-compile python for android which would cut the future build attempts in two, because there will not be that "checking out python and building it in temp directory and deleting it afterwards" step everytime.
To my surprise, this did not in fact even try to cross compile python, instead going to compile shiboken. It seems that "-occp" flag really means to "only cross compile pyside" instead
In pyside-setup/tools/cross_compile_android/main.py, line 161, there is the hard-coded upstream Python repo url.
git clone that somewhere. Then checkout the branch set by PYTHON_VERSION constant hard-coded at the top of the script. (i.e. git checkout 3.10). Then replace the URL in main.py with the local path to your checkout.
also, when cpython is being cross-compiled, it tries to link with libssl/libcrypto in /usr/local/lib which predictably fails. I have cross-compiled openssl, but how can i provide it to the cross-build?
Hmmm. I can't remember if I had to do that or if it is ok for this to fail. It only needs the cross-compiled Python to build the wheels. And for that, SSL isn't really needed.
Try create it as an empty directory. I'm pretty sure that this is required to do. (I'm relatively sure I remember that from my experiments around April 20th)
from main.py:
# line 86
parser.add_argument("-apic", "--android-python-install-path"
[…]
# line 109
python_path = args.android_python_install_path
[…]
# line 119 & 120
valid_python_path = True
if python_path and Path(python_path).exists():
# line 155, guarding the full cross compile build step
if not python_path or not valid_python_path:
When supplying a path that does not exist, python_path is non-empty and Truethy. The block starting 120 is skipped, because the path does not exist.
Then in 155, not python_path is False and not valid_python_path is False, because setting it to False was skipped in the block starting at 120.
Both checks are False, and the whole block is skipped.
The -apic option sets the directory where the cross compiled Python should be placed. If not given, a temp directory will be used and thrown away. The script simply fails to create the directory, if it is passed as an argument
If you specify -occp, then it also expects you to give a path where the cross compiled Python should be created. It just doesn't recursively create the parent non existing folders.