Open cirospaciari opened 1 year ago
Something like this
build-linux-arm:
needs: build-linux
runs-on: ubuntu-latest
name: Build on linux-arm64
steps:
- uses: uraimo/run-on-arch-action@v2.1.1
with:
arch: aarch64
distro: ubuntu20.04
install: |
apt-get update -q -y
apt-get install -q -y build-essential cmake libz-dev golang libuv1-dev git
run: |
git clone --recursive https://github.com/cirospaciari/socketify.py.git
cd socketify.py/src/socketify/native
make linux
cd ../
git add libsocketify_linux_arm64.so
git config --global user.email "ciro.spaciari@gmail.com"
git config --global user.name "Ciro Spaciari"
git commit -m "[GitHub Actions] Updated linux-arm64 binaries" || true
git push "https://cirospaciari:${{ secrets.BUILDTOKEN }}@github.com/cirospaciari/socketify.py.git"
Maybe this will help someone in the future.
I've compiled libsocketify on rpi4@aarch64 but it required few changes.
make
PLATFORM=aarch64
socketify.py/src/socketify/uWebSockets/uSockets/boringssl/crypto/bytestring/cbs.c: In function ‘CBS_get_asn1_int64’:
socketify.py/src/socketify/uWebSockets/uSockets/boringssl/crypto/bytestring/cbs.c:505:20: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
505 | sign_extend[i] = data[len - i - 1];
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
socketify.py/src/socketify/uWebSockets/uSockets/boringssl/crypto/bytestring/cbs.c:502:11: note: at offset 8 into destination object ‘sign_extend’ of size 8
502 | uint8_t sign_extend[sizeof(int64_t)];
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
I was able to finally build it with this cmd CFLAGS="-Wno-error=stringop-overflow" make linux PLATFORM=aarch64
Later in socketify/native.py
it tried to load amd64
version so i changed "arm" in platform.processor().lower()
to
("arm" in platform.processor().lower() or 'aarch64' in platform.machine().lower())
which solved the problem.
platform.processor()
returned empty string.
Linux on ARM is used a LOT (think in raspberry pi), a docker build or cross compile is an option. Windows on ARM on laptops use maybe grow so adding support is a great thing.
Today we support the most used cases (https://github.com/cirospaciari/socketify.py/issues/12): Windows x64 Linux x64 MacOS ARM and x64