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

uniffi-bindgen seemingly not built for host target with generate-ci workflow #2461

Open
1 of 2 tasks
joe-p opened this issue Feb 1, 2025 · 1 comment
Open
1 of 2 tasks
Labels
bindings/uniffi uniffi bindings bug Something isn't working

Comments

@joe-p
Copy link

joe-p commented Feb 1, 2025

Bug Description

Using the workflow from maturin generate-ci results in failures because uniffi-bindgen is seemingly being built for a target other than the host.

      Running `target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen generate --no-format --language python --out-dir /home/runner/work/Algorand-Rust-FFIs/Algorand-Rust-FFIs/target/maturin/uniffi/algo_models --library /home/runner/work/Algorand-Rust-FFIs/Algorand-Rust-FFIs/target/aarch64-unknown-linux-gnu/release/maturin/libalgo_models_ffi.so`
target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen: 1: �ELF�������K�@��=�@8: not found
target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen: 2: Syntax error: ")" unexpected

The above errors suggests that the binary is was not properly built for the host, although I haven't dug deep into how the maturin action works to confirm this is 100% the problem.

The full action output can be seen here: https://github.com/algorandfoundation/Algorand-Rust-FFIs/actions/runs/13089547874/job/36524600363?pr=7

Your maturin version (maturin --version)

1.8.1

Your Python version (python -V)

3.13.1

Your pip version (pip -V)

Unsure (github action)

What bindings you're using

uniffi

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. Attempt to run the following workflow https://github.com/algorandfoundation/Algorand-Rust-FFIs/actions/runs/13089547874/workflow
@joe-p joe-p added the bug Something isn't working label Feb 1, 2025
@messense messense added the bindings/uniffi uniffi bindings label Feb 5, 2025
@joe-p
Copy link
Author

joe-p commented Feb 6, 2025

This seems to be a bug with maturin specifically when using the manylinux images.

I have a successful workflow that is using the cross-rs image to run maturin build and I can see

      Running `target/debug/uniffi-bindgen generate --no-format --language python --out-dir /workspace/target/maturin/uniffi/algo_models --library /workspace/target/aarch64-unknown-linux-gnu/release/maturin/libalgo_models_ffi.so`
📦 Built wheel to /workspace/target/wheels/algo_models-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

However, using the same approach with the manylinux2014 image in this workflow results in:

      Running `target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen generate --no-format --language python --out-dir /workspace/target/maturin/uniffi/algo_models --library /workspace/target/aarch64-unknown-linux-gnu/release/maturin/libalgo_models_ffi.so`
target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen: 1: �ELF�������K�@p�=�@8: not found
target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen: 2: Syntax error: ")" unexpected
💥 maturin failed
  Caused by: Command cd "/workspace" && "cargo" "run" "--bin" "uniffi-bindgen" "generate" "--no-format" "--language" "python" "--out-dir" "/workspace/target/maturin/uniffi/algo_models" "--library" "/workspace/target/aarch64-unknown-linux-gnu/release/maturin/libalgo_models_ffi.so" failed

Notice the passing workflow runs target/debug/uniffi-bindgen whereas the manylinux workflow runs target/aarch64-unknown-linux-gnu/debug/uniffi-bindgen

This makes me believe it's either a problem with the manylinux image itself or a problem with how maturin builds the binary for the specific target

joe-p added a commit to algorandfoundation/Algorand-Rust-FFIs that referenced this issue Feb 6, 2025
see PyO3/maturin#2461 for the problem with
manylinux containers
joe-p added a commit to algorandfoundation/Algorand-Rust-FFIs that referenced this issue Feb 8, 2025
…ckage (#7)

* add pyproject for maturin build

* maturin pytest workflow

* attempt to fix workflow dirs

* fix requirements path

* add -vv to matirun workflow

* rm maturin CI in favor of hand-written Python CI

* attempt docker run/exec

* git rid of container config in job

* docker run args

* rest of steps using docker exec

* cd to crate

* add pytest step

* add mise env to install

* allow mise to compile python

* install bash for alpine

* mkdir /mise/cache

* mkdir full pyenv cache dir

* mise -vv

* use mise  v2025.1.14

this is the last version before mise switched from git2 to gix, maybe
that will help the bug I've been seeing

* just use apk to install python

* use --break-system-packages with pip

* add gnu target

* use curl

* install curl

* fix wheels path

* add comments to workflow file

* build_and_test with windows

* uncomment other build_and_test runners

* remove cross postfix

* uncomment cross_build

* add sdist_build_and_test

* try using manylinux

* install rustup

* set CARGO_HOME

* restore working cross-rs-based workflow

see PyO3/maturin#2461 for the problem with
manylinux containers

* try quay.io manylinux container

* restore last image

* add glibc and musl doc

* add compatibility flag to maturin build

* use cross image for x86_64 linux

* fix container url

* fix container version

* use centos image

* try manylinux container

* use zig for x86_64 manylinux_2_17

* try glibc 2.26

* manylinux_2_27

policy not defined for 26

* try manylinux image for aarch64 2.28

* use macos runner for aarch64 linux

* try ubuntu arm runner

* add x86_64 manylinux container

* bump up maturin compat flag

* use GH runner to run pytest when possible

* use manylinux musl image

* dont use mise in manylinux containers

* specify python version

* python3.10 -m maturin

* derive env from matrix

* fix workflow errors

* fix container

* alpine aarch64 pytest

* try setting up qemu

* pytest in build container

* cd /workspace

* try s390x

* add s390x arcg

* use 2d matrix, always pytest in build container

* libc in matrix

* python version env

* capitalize env

* use python_version

* fix python typo

* try manylinux2014

* update comments and doc

* breakout pytest steps

* don't install zig

* don't setup qemu

* try all arches

* setup qemu

* exclude s390x musl

* exclude ppc musl

* set default host for rustup

* fix target typo

* fix ppc triplet

* skip i686 musl, add back ppc musl

* skip ppc musl

thought it's supported
https://doc.rust-lang.org/nightly/rustc/platform-support/powerpc64le-unknown-linux-musl.html,
but guess not...

* add arm windows

* fix format

* skip pytest for windows arm

* add comment regarding arm windows

* replace SCRIPT with RUN

* disable i686, ppc64le, s390x

* update build script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/uniffi uniffi bindings bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants