emmett-framework / granian

A Rust HTTP server for Python applications
BSD 3-Clause "New" or "Revised" License
2.86k stars 83 forks source link

Does not work on Raspberry Pi Zero #85

Closed JakubKoralewski closed 10 months ago

JakubKoralewski commented 1 year ago
$ granian
Illegal instruction
$ uname -a
Linux pizero 6.1.31+ #1654 Tue May 30 17:08:26 BST 2023 armv6l GNU/Linux
$ dpkg --print-architecture
armhf
$ sudo cat /proc/cpuinfo
processor   : 0
model name  : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 997.08
Features    : half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2835
Revision    : 9000c1
Serial      : 0000000020b13298
Model       : Raspberry Pi Zero W Rev 1.1
usr/local/lib/python3.9/dist-packages/granian $ objdump -f _granian.cpython-39-arm-linux-gnueabihf.so 

_granian.cpython-39-arm-linux-gnueabihf.so:     file format elf32-littlearm
architecture: armv7, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x0000e700

https://raspberrypi.stackexchange.com/questions/87392/pi1-armv6-how-to-disable-armhf-packages/87403#87403:

Both Raspbian and Debian pride themselves in suppporting the "armhf" architecture. Of course, they mean two different things !

Raspbian "armhf": ARMv6 + VFPv2 Debian "armhf": ARMv7

gi0baro commented 1 year ago

@JakubKoralewski I'm quite sure it's not possible to produce wheels for armv6 architecture.

The only suggestion I can make is to get the source code and Rust and try to compile it directly on the target architecture, even if I have no idea if it works. You might try with pip directly or with maturin.

JakubKoralewski commented 1 year ago

I'm quite sure it's not possible to produce wheels for armv6 architecture.

What about piwheels.org?

Tensorflow has armv6 wheels on piwheels.org: https://www.piwheels.org/simple/tensorflow/tensorflow-1.14.0-cp37-none-linux_armv6l.whl

gi0baro commented 1 year ago

@JakubKoralewski it looks like they build also granian: https://piwheels.org/project/granian/

Unfortunately it seems that recent maturin versions won't play well (this is deducted by the fact similar packages seem to suffer the same issue, like https://piwheels.org/project/pydantic-core/).

I still think this is quite hard to fix in granian itself, maybe you can open up an issue in the maturin project for this.

JakubKoralewski commented 1 year ago

Looks like no Cargo on the Pis used by Piwheels

2023-05-28T14:10:33,286 Cargo, the Rust package manager, is not installed or is not on PATH. 2023-05-28T14:10:33,286 This package requires Rust and Cargo to compile extensions. Install it through 2023-05-28T14:10:33,287 the system's package manager or via https://rustup.rs/ 2023-05-28T14:10:33,287 Checking for Rust toolchain.... 2023-05-28T14:10:33,305 ERROR: [present-rich] Preparing metadata (pyproject.toml) exited with 1

gi0baro commented 10 months ago

I'm closing this due to inactivity, it also seems some versions are available on piwheels

waghanza commented 4 months ago

@gi0baro I have the same on a mac mini m1

root@4321ef340a67:/usr/src/app# granian
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 8 bytes failed
Aborted (core dumped)
root@4321ef340a67:/usr/src/app#