cmake/ninja: Not working after installing wheel via pip
cmake and ninja as C++ build tools can be installed as python packages by using pip.
BUT: If I do that I seem to get a broken package (or some file permissions are not correct: maybe executable permissions are missing).
HOW TO REPEAT:
$ pip install ninja
…
Using … ninja-1.10.2.3-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl
…
$ ninja —version
ninja: command not found
$ python -m ninja —version
$HOME/Library/lib/python3.9/site-packages/ninja/data/bin/ninja: command not found
# ALTERNATIVE: export PATH=“$PATH:$HOME/Library/bin“
# USE: ninja —version
RELATED:
- #117 (cmake related)
pip is only installing the Python interface to cmake or ninja, not the commands themselves. Installing the commands would require cross-compiling the commands, which is difficult. make was already not easy.
I have these in mind, but they're distant goals.
Actually, I am not quite sure if cross-compiling is necessary.
pip installs a wheel which contains the prebuilt binary programs/libs.
The python package for ninja/cmake is basically only used as transport vehicle to install a rather new version of these programs (because you normally get much older ones on Ubuntu/Debian).
If the wheel package configuration would be a complete mismatch for the iPad, it would probably not install it.
For example:
$ cd $HOME/Library/lib/python3.9/site-packages/ninja/data/bin
$ file ninja
ninja: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_
WEAK|PIE>] [arm64:Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|WEAK_DEFINES|BINDS_TO_WEAK|PIE>]
HINT: The iPad has a processor with arm64 architecture (but: wheel was packaged with macOS in mind. Therefore, any dynamic-library may cause problems).
OR: Would I need to cross-compile and link it with your SDK for the ios_system ?
It's good to know that pip installs the binaries, but these binaries are for Arm64-MacOS, and are not compatible with Arm64-iPadOS. There are differences in packaging, but also with binary signatures and security. iPadOS will only execute binaries that have been signed with the app developer certificate, and also installed in a specific directory ($APPDIR).
Linking with ios_system would be good too, but that only impacts where the standard output goes. And also what happens when the command forks to execute a new command, which happens a lot with cmake and ninja, so actually that would be quite useful.