Skip to content
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 armv6 target #330

Closed
wants to merge 1 commit into from
Closed

add armv6 target #330

wants to merge 1 commit into from

Conversation

DarkC35
Copy link

@DarkC35 DarkC35 commented Dec 28, 2022

Hi, I'm currently trying to install Home-Assistant Core on a Raspberry Pi Zero WH (armv6) and stumbled upon an inconvenience that could be (hopefully) solved via the GH Action: since HA dropped support for the Zero with the HAOS the only way to install it is via pip. According to this community comment the installation on a Zero is possible but takes up to 15 hours (when rust and maturin are already installed as dependency before installing HA). I can confirm that the Collecting orjson==3.8.1 Downloading... Installing build dependencies... takes more than 4 hours (htop showed a rustc process that uses 100% CPU, but I did cancel it manually and am currently trying to install it a second time).

I'm not familiar with building pip packages and would need guidance on how to test locally on some emulated docker image¿ if needed (since building it on the Zero seems out of question with the >10h build time; I'm not sure yet if any other dependency takes some hours to build too and orjson "only" requires about 5h).

Looking on the linux-cross GHA the matrix.target is used by uraimo/run-on-arch-action which supports armv6 and messense/maturin-action but I'm not sure if Cargo ... --target armv6 ... is going to work (I'm not familiar with rust as well and I don't know if this is related?).

It would be very helpful if this simple armv6 addition could be provided if everything works out-of-box via GHA without changing anything. If it's not working you can close this PR and I hope everything works after 15h and I don't have to update this debug setup anytime soon.


Some additional infos: Similar to the HA community post I intend to use my spare Zeros for some HA debugging and testing as all my Pi3 and Pi4 are occupied; I don't intend it to run a full-blown smarthome on it.

Steps to reproduce the 15h build:
(maybe?) Build the repo on a Raspberry Zero.

(or using my way) Install HA:

  1. flash Raspberry OS lite 32bit on a Pi Zero
  2. install dependencies as described in the HA installation guide
  3. skip all those "security" steps that requires to add a new user and setup the venv as not needed in this test case
  4. install rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  5. install maturin? pip install maturin
  6. install HA pip install homeassistant==2022.12.8

Without installing rust (and maybe maturin) first the command pip install homeassistant (without providing a version) installed version 2022.6.4 in my case (as some newer python wheels failed, so I guess it falls back to the newest it is able to install?).

@ijl
Copy link
Owner

ijl commented Dec 28, 2022

I see failures with different components. The most I have is this, with errors where gcc can't link it:

name: linux-armv6
on:
  push:
    branches:
      - '*'
    tags:
      - '*'
jobs:
  linux-armv6:
    runs-on: ubuntu-22.04
    strategy:
      fail-fast: false
      matrix:
        python: [
          { version: '3.7', abi: 'cp37-cp37m' },
          { version: '3.8', abi: 'cp38-cp38' },
          { version: '3.9', abi: 'cp39-cp39' },
          { version: '3.10', abi: 'cp310-cp310' },
          { version: '3.11', abi: 'cp311-cp311' },
        ]
        target: [
          { arch: 'arm-unknown-linux-gnueabi' },
        ]
    steps:
    - uses: actions/checkout@v2
    - name: Build Wheels
      uses: messense/maturin-action@v1
      env:
        PYO3_CROSS_LIB_DIR: "/opt/python/${{ matrix.python.abi }}"
        CFLAGS: "-Os -fno-plt -flto=thin"
        LDFLAGS: "-Os -flto=thin -Wl,--as-needed"
        RUSTFLAGS: "-C opt-level=s"
        CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
        ORJSON_DISABLE_YYJSON: "true"

      with:
        maturin-version: v0.14.7
        target: ${{ matrix.target.arch }}
        rust-toolchain: nightly
        manylinux: auto
        args: --release --strip --out dist -i python${{ matrix.python.version }}

That's assuming the artifact isn't tested, as well, since what's used for other cross-compilation jobs doesn't appear to support this.

Feel free to experiment on that in a fork and open a pull request that solves it. It definitely isn't drop-in.

@ijl ijl closed this Dec 28, 2022
@DarkC35
Copy link
Author

DarkC35 commented Dec 28, 2022

Thank you very much for testing! Didn't expect a full-blown new workflow for this exotic use case.

Just out of curiosity: why using arm-unknown-linux-gnueabi instead of the arm-unknown-linux-gnueabihf like in the linked issue above as most issues I found referred to the hf one (e.g. this one). (Might be a dumb question as all those architecture stuff is quite out of my comfort zone.)

I also took a quick look on the actions you tried and wanted to share that the messense/maturin-action action seems to be renamed to PyO3/maturin-action as it looked like you did some kind of cleanup ;D

@ijl
Copy link
Owner

ijl commented Dec 28, 2022

I think I tried that and it failed. I just pasted the last I had before stopping. Yes, I'll updat ethe actions then, thanks.

@DarkC35
Copy link
Author

DarkC35 commented Dec 28, 2022

I did some testing but am stuck now with rust/linux/docker/qemu problems. If you are interested here is my failing workflow and the action log. I think I will give up here and try to use something like DietPi in the future for my exotic use case. Anyway thanks for helping.

On the glad side: The Zero managed to build orjson and everything else after about 7h or 8h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants