-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
Add armv7l (32-bit arm) build #124
Comments
Sure, let's wait for the official release. |
Fwiw, I have an older build of curl_cffi for armv7l here: https://github.com/bjia56/armv7l-wheels It uses the changes I contributed upstream to curl-impersonate, but builds libraries against an older glibc than the cross compiler, so should have greater Linux version compatibility. |
If there's interest for upstream curl_cffi to be able to build armv7l wheels and pull in the releases from upstream curl-impersonate, I highly recommend modifying setup.py to download the shared objects based on detected architecture as part of build, so the piwheels project can automatically pull it into their build system. |
I'm trying to incorporate upstream changes on this branch. Basically, I just changed the version numbers. I haven't touched the armv7l parts yet, since it seems that CI build process needs to change for cross compiling. PRs are welcome if you would like to work on this. |
Haven't seen that before, it looks like the build might require cross compiling zstd (a compression library) before linking. Perhaps it is a newer dependency to chrome? |
It looks like it also failed on arm64 with same linking error. Did your change enable zstd? I see it disabled in the upstream build. Could also be because you bumped the Ubuntu builder version, newer libraries exist on the system and it's trying to pull in zstd. Might need to change the curl-impersonate Makefile to specifically turn off this library. |
btw - I'm starting to test your build of curl-impersonate in my armv7l wheels repo. It'll be nice to get a newer curl build in, thanks for your effort on updating the build! edit: The build for curl 8.1.1 succeeded on my armv7l docker container, which is running centos 7. So I suspect it's due to the newer Ubuntu image. |
Just checked replated projects and it seems that |
If setup.py downloads the libcurl binaries from gh (based on architecture) as part of the build (instead of a preprocess makefile step), then piwheels.org will be able to automatically produce armv7l wheels built on real 32 bit raspberry pi hardware. |
I see, at least we can make |
Since sdist now working, we need just push a release to pypi then piwheels.org will then able to produce armv7l bdist wheel automatically. |
piwheels is still experiencing build errors for 0.6.0: https://www.piwheels.org/project/curl-cffi/ |
Maybe this (and the armv7l below) should just be |
Updated in v0.6.1, does it work? |
Unfortunately not quite, it looks like the latest so download fails because arm-linux-gnu.tar.gz needs to be arm-linux-gnueabihf.tar.gz |
Which one should be changed then? Here or curl-impersonate? I'm not really an expert in embedded compiler names. |
It's probably more correct to change in curl-cffi to specify the platform triplet of arm-linux-gnueabihf in libs.json (for this and other platforms as well). arm32 is finicky since it's got a wide number of optional hardware features that vary from manufacturer to manufacturer, so the gnueabihf is needed to say that there needs to be hardware floating point support on the machine. |
I guess changing the sysname will fix it without adding another platform triplet property https://github.com/yifeikong/curl_cffi/blob/main/libs.json#L70 |
Do you mind opening a PR? I'm not sure if we have the |
Sure. The arm builds are built against armv6l which will also work on armv7l, so both platforms will work fine with the same download. |
#255 opened. Trying to build it on my raspberry pi is also having other errors related to missing types such as |
Yes, it's in the sdist tarball. |
For folks following this thread - there are still some pending items to work through for piwheels to properly build wheels that can just be downloaded and used directly. In the meantime, I will be maintaining prebuilt wheels (with so's bundled in) over on my armv7l index here: https://bjia56.github.io/armv7l-wheels/curl-cffi/ |
Here is the resutls from my RPi Zero 2W, running >>> import platform
>>> platform.uname()
uname_result(system='Linux', node='raspberrypi', release='6.1.21+', version='#1642 Mon Apr 3 17:19:14 BST 2023', machine='armv6l') Which shows this:
|
Do you also get illegal instruction when using the curl-impersonate-chrome executable? |
Can you try something like this to identify which instruction is involved: https://stackoverflow.com/a/40223712 |
Yes. But I found out that it works for http site. |
My guess is boringssl is trying to do some hardware-optimized assembly that isn't available for that particular raspberry pi model. I can test with my raspberry pi 1 (also armv6) later today or tomorrow |
It seems that the last instruction is a
Maybe armv6l is too old to be supported. |
Yeah, that matches my suspicion. There's a couple root causes I can think of:
I can take a look at the first item. If it turns out that the second one is the issue, then I might say it's too much hassle to support and we should just stick with armv7l and beyond. Alternatively, we can try compiling with |
Testing Zig with the following code (courtesy of ChatGPT) implies that NEON is not enabled by the compiler. I see BoringSSL is doing some runtime CPU capability magic, might be possible to disable that with CFLAGS. #include <stdio.h>
// Function to detect NEON support
int detectNEON() {
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
return 1;
#else
return 0;
#endif
}
int main() {
if (detectNEON()) {
printf("NEON instructions are enabled by the compiler.\n");
} else {
printf("NEON instructions are not enabled by the compiler.\n");
}
return 0;
} |
Some time ago I got this same issue when compiling BoringSSL to At that time I fixed this by compiling BoringSSL with |
I've tried a bunch of stuff over on lexiforest/curl-impersonate#49 but unfortunately the compiler still spits out three One such case is in this function:
This looks to me like some loop is getting vectorized, since there's no clear crypto calls being made in this section. However, attempting to disable compiler vectorization with Clang's flags hasn't made a difference. My hunch is that there's probably some bug in the Zig compiler that's still producing NEON instructions even with multiple attempts to disable it. I might be able to poke around at the compiler code sometime later to see if there's a root cause, but for now I suggest we drop armv6 until further notice. |
Looks like I spoke too soon. Propagating the -mcpu flag directly down to Zig seems to work, instead of going through CFLAGS. I was able to get a build that runs without the illegal instruction error on my Raspberry Pi 1. Perhaps something (maybe cmake?) in the layers of build toolchains messed things up. |
Also appears that keeping BoringSSL's assembly and CPU feature detection in the build works as well, so we should still be able to build one distribution for both armv6 and armv7, and dynamically use NEON when hardware has the support. |
I see wheels at https://www.piwheels.org/project/curl-cffi/ built successful on v0.6.2. Can you verify these wheels works as expected? |
The build on piwheels works for me. |
curl-impersonate has recently added builds for armv7l: lwthiker/curl-impersonate@9303ce3
Currently these are only present in the new 0.6.0 alpha release, but once that is stabilized it would be great if we can also get some armv7 builds running for curl_cffi too.
https://github.com/lwthiker/curl-impersonate/releases/tag/v0.6.0-alpha.1
The text was updated successfully, but these errors were encountered: