-
Notifications
You must be signed in to change notification settings - Fork 36
Installing cmake on aarch64 using pip via wheel #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @thewtex , Installation of cmake is taking time while building from a source in aarch64. It will be efficient and helpful if wheel is added for the same as many packages are dependent on cmake. |
@odidev Since pypa/manylinux#84 is still open, my impression is that pip / manylinux support is a work in progress. This means that even if we create a wheel and upload it, pip will not recognize that it can use it. But, we can try to create it -- users may just need to download the *.whl file manually to install it. @odidev would you like to try to create a wheel based on the toolchain provided in: https://github.com/pypa/manylinux/blob/manylinux2014/docker/Dockerfile-aarch64 ? |
It is also worth noting that dockcross may enable cross-compiling of the wheels from x86_64 systems, which could help alleviate build time and CI resource issues. |
If there is interest and human resources to make it happen, an approach similar to what was discussed in scikit-build/ninja-python-distributions#22 (comment) could be implemented for aarch64 wheels In a nutshell, wheels for aarch64 would be hosted as assets in a github release associated with this project and could be installed using something like this:
|
And since we would need wheels for ninja and cmake, the project |
@thewtex , Thanks for the suggestion. I have created a dockerfile for creating wheel based on suggested toolchain. Please find below dockerfile used to create cmake wheel. Dockerfile: FROM quay.io/pypa/manylinux2014_aarch64:latest RUN yum update -y RUN mkdir /tmp/dl && cd /tmp/dl RUN git clone https://github.com/scikit-build/cmake-python-distributions && cd cmake-python-distributions Wheel(cmake-3.16.3.post1+g0f6336c-cp36-cp36m-linux_aarch64.whl) has been created in dist folder. Can you suggest me on how can we upload it to releases? |
Thanks for the suggestion. In https://github.com/dockcross/dockcross, we don't have dockerfile for manylinux2014_aarch64. We have only manylinux2014_x64. I think we require that to build wheel through dockcross or I may be wrong, please suggest me on how can we use that for manylinux2014_aarch64? Thanks. |
Awesome! Well done @odidev ! 🎉 🥇
The image to try is
If cross-compiling works, you could configure a GitHub Action on your fork to build the wheel on If cross-compiling does not work, a hosted GitHub Action worker could be possible if you have hardware you can keep available for the cause. |
Hi @thewtex , Thanks for the suggestion. I am able to successfully cross-compile using python crossenv and built aarch64 wheel. Checking on github actions for pushing wheel to release. Dockerfile: Dockerfile_cmake_cross Travis-CI has added support for arm64. We can build wheel for arm64 and deploy to github releases with tag aarch64-python-wheels. Sample code to build in Travis: language: python matrix: script: before_deploy: deploy: If we can follow this, I think we can upload to git hub releases with tag aarch64-python-wheels. Can we do this process as through this process it is easy to build and upload to releases? |
@odidev well done! 👏 🔢
Yes -- perhaps you can develop and test the TravisCI configuration and GitHub Action on your folk, then we can enable and merge here when ready. arm64 CMake packages will very helpful to the community. |
I was setting up CD with cibuildwheel these days and its really simple to set up if you already have a great wheel recipe like yours in place. You can drive Linux/Windows/OSX builds, the former for ppc64le, aarch64, s390x, i686 and amd64, with the popular open CI platforms in quite compact setups. I was able to build |
Hi @thewtex , I have successfully built aarch64 wheel with an aarch64 job. I have modified the travis file as per my requirement to build and deploy the wheel on git release. You can have a look at the same git release at https://github.com/odidev/cmake-python-distributions/releases/tag/aarch64-python-wheels. Using aarch64 job cmake wheel can successfully be deployed. Travis link: https://github.com/odidev/cmake-python-distributions/blob/master/.travis.yml Please check the travis file and we had to remove PyPI deployment phase to check deploying aarch64 wheel to git releases with tag. Please suggest if any more changes are required. |
I think PyPI has added support for aarch64 wheels. I have tested 2 samples NumPy as NumPy-demo and lxml as lxml-odidev. We can install NumPy-demo and lxml-odidev packages from aarch64 wheel itself from pip 19.3 versions whereas with pip versions below 19.3 these packages are being installed from tar file rather than the wheel. So, we tried testing cmake as cmake-odidev, wheel is building successfully but we are facing below issue in version while uploading wheel: Deploy steps used: I have tried giving static version in setup.py and versioneer.py but still, I am getting the same error. Maybe, If we add deploy steps for aarch64 wheel as well in CMake Travis, we can upload CMake aarch64 wheel as well while uploading x86_64 wheels to PyPI. Please check on the same, To proceed further on testing the process of uploading the cmake-odidev aarch64 wheel and reusing it, I require your suggestion regarding the version issue. Please let me know if any more information is required. |
That is exciting 🎉 As a side note, I am sorry for the slowness in reviewing your awesome contributions, and thanks again for your patience and perseverance. We will get there 💪 🙏
That makes sense. Could you update this part of the the CI configuration to also run the tests: Once we confirm the tests pass, we will update the current CI to integrate with your changes and make sure the wheels are uploaded.
This error makes sense, in a nutshell only tagged version can be uploaded. |
Awesome, looking forward to use the new wheels! 🚀 Just adding the reference to currently supported PyPI platforms that we can potentially build CMake packages for: |
An other task would be to add new images to dockcross for platforms we would like to build wheels for. See https://github.com/dockcross/dockcross We could start with Help would be greatly appreciated 🙏 This file could be used as a template, see https://github.com/dockcross/dockcross/tree/master/manylinux2014-x64 |
I have updated the file with tests as well. Please check https://github.com/odidev/cmake-python-distributions/blob/arm64_test/.travis.yml All tests are passing successfully. Please find below link for travis report. Report: https://travis-ci.org/github/odidev/cmake-python-distributions/builds/681396733 Please let me know if any more updates are required. |
@jcfr ,
As suggested, with the tagged release we are able to upload cmake-odidev aarch64 wheel to PyPI. PyPI files: https://pypi.org/project/cmake-odidev/#files Installation: root@eddbd327b464:/# cmake --version CMake suite maintained and supported by Kitware (kitware.com/cmake) Please check and let me know if any more information is required. |
@jcfr ,
I have started checking on adding manylinux2014-aarch64 into dockcross. You can check my findings in the comment dockcross/dockcross#367 (comment) and suggest if any resolutions on the issues. |
@jcfr , May I know when the cmake aarch64 wheel will be uploaded? Do I need to raise a PR for uploading aarch64 wheel? |
I will so my best to get to it this week. Thanks for your patience 🙏 |
@jcfr , May I know if there any update on uploading cmake aarch64 wheel to PyPI. Thanks. |
See #96 Co-authored-by: odidev <[email protected]>
See #96 Co-authored-by: odidev <[email protected]>
I just submitted a PR to add support for building aarch64 wheel. It turns out their are the following issues:
|
This commit explicit sets the path to the strip executable to ensure the cmake aarch64 executable can be stripped. See #96 Co-authored-by: odidev <[email protected]>
See #96 Co-authored-by: odidev <[email protected]>
This commit explicit sets the path to the strip executable to ensure the cmake aarch64 executable can be stripped. See #96 Co-authored-by: odidev <[email protected]>
See #96 Co-authored-by: odidev <[email protected]>
This commit explicit sets the path to the strip executable to ensure the cmake aarch64 executable can be stripped. See #96 Co-authored-by: odidev <[email protected]>
@jcfr , Thanks for uploading wheel. I am able to successfully install cmake using wheel now as verified below:
But commands "cmake --version" or "cmake -h" are not giving any output.
Can you please suggest what I am missing here? Thanks. |
Can you please suggest what I am missing here? What is the output of What happen if you directly run the cmake executable shipped in the wheel ? For example, assuming a virtualenv called
Background: Since I had to disable the test (see 59e9f9d) because the python interpreter available in the dockcross image |
@jcfr , Please find below output of which and cmake commands:
It is giving segmentation fault. |
output of "file" commandNow what is the output of:
and how does it compare with the output of an executable known to work on this system ? simple hello worldThen, if you compile a simple hello world executable using First, run the image: cd ~
dockcross-manylinux2014_aarch64 bash Then compile small executable:
Last, copy For reference, here is the output of the file command: $ file hello
hello: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 4.10.8, not stripped Does it run ? Additional experimentThe cmake wheel is compiled with the following flags: cmake-python-distributions/CMakeLists.txt Lines 190 to 191 in f18454b
I wonder if some of these flags are problematic on aarch64 ... |
File command Output of cmake executable:
Created executable as suggested.
Copied to the local arm64 system and ran hello executable. Output:
I am not sure on cmake flags. Need to analyze more on them. |
The hello world works, this means this is something wrong with cmake executable. On the target system where you have the seg fault, could you update the setting so that it generate a coredump file ? Reading this should give some hint: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/Debug_Instructions#Analyze_a_segmentation_fault Out of curiosity, are you able to run
|
The output of
Please find below coredump files of cmake, cpack and ctest executables(shared as text files): Backtrace of
Backtrace of
Backtrace of
I am unable to get symbols information. Maybe, while generating cmake binary, we can enable symbols as well to check with gdb. Please let me know if any more information is required. |
That doesn't provide us much information. Could you look into creating a debug build of cmake using I also suggest to try removing the cmake-python-distributions/CMakeLists.txt Lines 190 to 191 in f18454b
To create a debug build, you could simply pass Since you were already able to build cmake for aarch64 ... we are close: |
@jcfr , Thanks for the references and build steps. I have built openssl from github, cmake binary is getting built but command I have built openssl 1.1.1.g and trying to build cmake wheel with below command:
I am getting below error:
Can you suggest if I am missing anything? Thanks. |
@jcfr , I have built cmake binary with symbols enabled using
I have tried after removing static* flags but generated CMake binary is still giving segmentation fault. Can I get any suggestions on how can I resolve this issue? |
I was previously encountering similar segfaults, and was going to dig in on debugging it, since it's hindering my work. Just now, I've got a working build, with minimal tweaking necessary. OS: Ubuntu 18.04.4 For the OpenSSL dependency, I simply Then, to do the CMake build, inside a virtual environment
That all went cleanly. Then, the results:
So, either other changes in the build have resolved the crash, or there's a meaningful difference between the defaults I'm using and the detailed specification of your build. |
Thanks for the explanation. I suppose that you are following the above steps in the aarch64 machine. I am able to successfully build a wheel in aarch64 machines and run cmake binary after installation. But, I am facing an issue with cmake binary created from the aarch64 wheel built on x86 host using dockcross/manylinux2014-aarch64. |
Indeed, this was on an Amazon c6 instance, which is an aarch64 machine. It might be wise to open a separate issue to track the further investigation of the bad build, especially so that others encountering the issue can find it. In the meanwhile, would it be possible to remove the prebuilt wheel for cmake on aarch64 from PyPI, so that users running |
@odidev As discussed here, cmake binaries generated using |
Thanks for the reply. I am checking into that issue. As a temporary solution, can we use qemu and build wheel directly in arm64 platform in Circle-CI. If it is fine, I will raise PR with the changes. |
Also seeing this issue on ubuntu20.04 Rpi 4 |
Summary
Installing cmake on aarch64 linux platform via pip using command "pip3 install cmake" tries to build wheel from source code.
Problem description
Cmake don't have wheel for aarch64 on PyPI repository. So, while installing cmake via pip on aarch64, it builds wheel from source which takes more time to install cmake. Making wheel available for aarch64 will benefit aarch64 users by minimizing installation time.
Expected Output
Pip should be able to download cmake wheel from PyPI repository rather than building it from source code.
@thewtex , I was able to build wheel with command "python setup.py bdist_wheel" and wheel has been created for specific python version in dist folder. I have tried installing in aarch64 linux platform with command "pip install cmake-xxx.whl", it got installed successfully. Please let me know if any help required in building wheel and uploading it to PyPI repository.
The text was updated successfully, but these errors were encountered: