socketify.py icon indicating copy to clipboard operation
socketify.py copied to clipboard

Create pre-build libraries for windows arm64 and linux arm64

Open cirospaciari opened this issue 3 years ago • 2 comments

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

cirospaciari avatar Nov 05 '22 15:11 cirospaciari

Something like this

 build-linux-arm:
    needs: build-linux
    runs-on: ubuntu-latest
    name: Build on linux-arm64
    steps:
      - uses: uraimo/[email protected]
        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 "[email protected]"
            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"

cirospaciari avatar Nov 05 '22 16:11 cirospaciari

Maybe this will help someone in the future.

I've compiled libsocketify on rpi4@aarch64 but it required few changes.

  • Platform had to be provided to make PLATFORM=aarch64
  • During compilation step i got error
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.

zelo avatar Jan 31 '24 18:01 zelo