-
Notifications
You must be signed in to change notification settings - Fork 43
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
Error during Cross-Compiling aws-iot-device-sdk-python-v2 with make #444
Comments
Based on a quick search with the first error, it seems the platform you are compiling for does not support x86 assembly, as that is what those error codes seem to indicate (example). My guess is that something in the compile process is not properly detecting you are trying to cross compile for ARM and so it tries to pull in x86 assembly. It looks like the errors are happening in Based on this issue on AWS LC, you may be able to tell CMAKE you are compiling arm by adding the following to this chunk of code in
As then that may inform CMAKE you are trying to cross compile for ARM and not x86, assuming the issue is that the CMAKE is trying to compile for x86 on an ARM platform. |
Hi @TwistedTwigleg thanks for the update. After adding below to
I still get same errors
|
Looking at the log, the following stands out to me:
Can you update the version of GCC you are using? I am not sure if it is related, but it may be possible that because GCC 10.3.0 is unsupported, that is causing other compile-time checks to not run. Regardless, for security purposes it would be beneficial to update GCC if you can. |
Hi @TwistedTwigleg , I think I managed to resolve the issue. I used the cmake provided by Buildroot instead of host cmake. And this somehow resolved it. At least build is successful. |
Great! I am going to close this issue then. Please also remember to update the AWS-LC issue you made and close it as well, so there's no duplicates and/or open issues that have been resolved. 🙂 |
Hello @TwistedTwigleg sorry for opening this issue again. I did a
I am also using this
in What's not clear is |
Hey @Sourabh-ALTEN, Not a problem, I will reopen the issue. Right off, I'm not sure what would have caused it to suddenly change and use the wrong system architecture. It seems to be something with AWS-LC, but from what I can tell, setting What could be happening, and this is entirely hunch based currently, is that AWS LC has it's own way for checking the system processor or the CMAKE process is somehow different, and that this change is what is making the build find the processor on the system building rather than the architecture for cross-compiling. |
Would it be possible to get Buildroot to download one of the precompiled wheels such as |
Or can you set the CMAKE_TOOLCHAIN_FILE env var so that CMake figures out the right way to cross-compile? |
@graebm What should I set in In the
|
Hello @graebm I think working with precompiled wheels is much better than cross-compiling. But, I wanted to ask about the precompiled wheel for awsiotsdk https://pypi.org/project/awsiotsdk/#files. Can this be used on all target machines? No machine specific wheels are available |
I don't know anything about Buildroot other than what I spent 5 minutes googling. I was just spitballing ideas. It's going to be a while before we have time to look into this. I'll dump some information here, for when we have time to dig deeper... aws-crt-python is a wrapper around a bunch of different C libraries. When building aws-crt-python, CMake is used to build these as static libraries, then Python's setuptools finishes linking them all together into a single shared library. It seems like we need to feed more information to CMake so that it builds for your target platform, instead of naively building for your host platform. We'll need to dig into how Buildroot and Python C extensions work together to determine to correct build configurations |
Hello @graebm @TwistedTwigleg finally I managed to cross-compile it. Included below lines in https://github.com/awslabs/aws-crt-python/blob/main/crt/CMakeLists.txt
But, when I tried to run the sample https://github.com/aws/aws-iot-device-sdk-python-v2/blob/main/samples/fleetprovisioning.py which parses Line 9 in f19344f
And then I get below error:
I don't know what is the reason for this? However, when I install awsiotsdk and awscrt using When checked with
Could you please let me know how to resolve this? |
This appears to be code in AWS-LC that is causing this error to occur. It seems to deal with FIPS keys and is an ARM processor function, from what I can tell. My guess, and this is pure speculation, is that the cross-compiler either doesn't have the ARM functions required or the cross-compiler is not indicating to AWS-LC which processor it has. Either way, the binary compiled seems not to have the Unfortunately, I have no idea how to tell AWS-LC which processor you have right off, as it seems to be done via build-time checks that determine which is being used. However, you might be able to get around this by disabling ASM entirely, though this may lead to decreased performance as it is not using ARM assembly, by setting (Side thought: I wonder if other submodules in the
With the exception of the BuildID, the only other change seems to be that the However, the default should be |
@TwistedTwigleg yes, yor right. I think cross-compile didn't work. I see further erros when I do:
Since these packages are not part of standard Buildroot, i had to add them. First I created python-packages https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_python_packages section 18.9.3 (Generating a python-package from a PyPI repository). Then this packages has to be added to buildroot-packages. And selected them in Buildroot config. Modified CMakeLists.txt file in https://github.com/awslabs/aws-crt-python/blob/main/crt/CMakeLists.txt to include |
I maintain a lot of buildroot's python cross compilation infrastructure and made a detailed write-up on the buildroot mailing list regarding what is required to support aws-crt-python in buildroot, copying the details here so that it's clear what is needed. The problem with building aws-crt-python in buildroot is that while the python awscrt package uses setuptools it's not a normal python setuptools package, the setup.py installs both a normal setuptools package and a vendored cmake package(meta package really). See cmake build wrapper functionality here in the setuptools setup.py file: This is the cmake meta project root which is vendored inside of awscrt: See meta cmakelists build: This meta project is made up of multiple subprojects:
In buildroot we expect cmake packages to use our cmake infrastructure as it will set up the cross compilation environment correctly while the awscrt setuptools cmake wrapper does not. I confirmed that the cmake packages build correctly when using our cmake infrastructure:
See: So what I think you need to do is create buildroot cmake packages for all You will then probably need to modify the setup.py file so that instead of using the cmake build functions have it use the system versions of these libraries pre-installed via the buildroot cmake infrastructure. You can probably use and check for an env variable such as this in the setup.py: When present have it disable building the cmake libraries itself and search or the installed system crt libraries instead of using the vendored cmake build. You should upstream this setup.py functionality to the aws-crt-project as well so that we don't need to carry a patch in buildroot for python-awscrt to use the system crt libraries. Then from the python-awscrt buildroot package you would set that env variable and add all the cmake subprojects as buildroot package dependencies. First thing you should start with is adding the cmake buildroot packages for the crt subprojects to buildroot and then work on modifying aws-crt-python to work correctly with them instead of trying to use the broken aws-crt-python cmake setuptools wrapper functionality. So this project will need to support system crt libraries in order for buildroot to support this python package. If the python package build is calling out to cmake it won't work correctly with buildroot(ie we need a way to disable the vendored cmake component builds) as doing so bypasses our cmake infrastructure. We need to build the cmake components separately and then have the python package build use those compoenents after the are built/installed. |
For buildroot we generally want to allow them to be built and installed as shared libraries unless there is a good reason not to.
This is not likely to be a viable approach for buildroot, we have separate cmake infrastructure that should be used independently of setuptools for building the crt components which require cmake. Trying to replicate all our cmake cross compilation logic in setuptools will be difficult and unreliable. |
This issue is really frustrating as I was having a similar problem with building in Docker using arm32v7/ubuntu:xenial. It was an ARM-based 32-bit architecture with an Ubuntu 16-based system. Along with
I wasted around one week trying to figure this out. I hope this helps others. |
Problem:
I am trying to cross-compile aws-iot-device-sdk-python-v2 which requires aws-crt-python. I am working on building a custom Linux distribution using Buildroot for aarch64. But during
make
I am getting below errors from asmBuild log:
I have no idea what it is complaining about. Can anyone please let me know how to reslove this?
Thanks in advance
The text was updated successfully, but these errors were encountered: