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

Failing with latest bindgen-cli (0.71.0) #624

Closed
juanky201271 opened this issue Dec 8, 2024 · 7 comments
Closed

Failing with latest bindgen-cli (0.71.0) #624

juanky201271 opened this issue Dec 8, 2024 · 7 comments

Comments

@juanky201271
Copy link

juanky201271 commented Dec 8, 2024

Problem:

Suddenly started to fail in CI, when trying to cross-compile for Android.

Relevant details

name = "aws-lc-sys", version = "0.23.1"
name = "aws-lc-rs", version = "1.11.1"

System information:

  • Github runners ubuntu-22.04 & macos-14

Build log:

Run cargo ndk \
  cargo ndk \
  --target aarch64-linux-android build \
  --release -Z build-std
  shell: sh -e {0}
  env:
    CACHE-KEY: 10b06857c8aec39a3c28a68656eb0e978f1b138d26c8f1a03dc74cf835c6c814
    ARCH: arm64-v8a
    REPO-OWNER: zingolabs
    RUSTUP_HOME: /root/.rustup
    CACHE_ON_FAILURE: false
    CARGO_INCREMENTAL: 0
    TARGET: aarch64-linux-android
    CC: aarch64-linux-android24-clang
    OPENSSL_PATH: aarch64
    AR: llvm-ar
    LD: ld
    RANLIB: llvm-ranlib
    OPENSSL_DIR: /opt/openssl-3.3.1/aarch64
    CARGO_FEATURE_STD: true
    Building arm64-v8a (aarch64-linux-android)
 Downloading crates ...
  Downloaded itertools v0.12.1
  Downloaded rustc-hash v1.1.0
  Downloaded android-tzdata v0.1.1
  Downloaded lazycell v1.3.0
  Downloaded android_system_properties v0.1.5
  Downloaded bindgen v0.69.5
    Updating crates.io index
 Downloading crates ...
  Downloaded getopts v0.2.21
  Downloaded allocator-api2 v0.2.18
  Downloaded rustc-demangle v0.1.24
  Downloaded adler v1.0.2
  Downloaded addr2line v0.22.0
  Downloaded miniz_oxide v0.7.4
  Downloaded memchr v2.5.0
  Downloaded hashbrown v0.14.5
  Downloaded compiler_builtins v0.1.125
  Downloaded gimli v0.29.0
  Downloaded object v0.36.2
  Downloaded unicode-width v0.1.13
  Downloaded libc v0.2.158
   Compiling compiler_builtins v0.1.125
   Compiling core v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.158
   Compiling memchr v2.5.0
   Compiling std v0.0.0 (/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling libc v0.2.167
   Compiling serde v1.0.215
   Compiling typenum v1.17.0
   Compiling generic-array v0.14.7
   Compiling radium v0.7.0
   Compiling libm v0.2.11
   Compiling num-traits v0.2.19
   Compiling slab v0.4.9
   Compiling parking_lot_core v0.9.10
   Compiling lock_api v0.4.12
   Compiling crossbeam-utils v0.8.20
   Compiling thiserror v1.0.69
   Compiling rayon-core v1.12.1
   Compiling rustix v0.38.41
   Compiling aws-lc-sys v0.23.1
   Compiling crunchy v0.2.2
   Compiling httparse v1.9.5
   Compiling ring v0.17.8
The following warnings were emitted during compilation:

warning: [email protected]: Building with: CMake
warning: [email protected]: Symbol Prefix: Some("aws_lc_0_23_1")
warning: [email protected]: CMAKE environment variable set: cmake
warning: [email protected]: Generating bindings - external bindgen. Platform: aarch64-linux-android

error: failed to run custom build command for `aws-lc-sys v0.23.1`

Caused by:
  process didn't exit successfully: `/__w/zingo-mobile/zingo-mobile/rust/target/release/build/aws-lc-sys-48a0d444effce481/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_SYS_PREGENERATING_BINDINGS
  cargo:rerun-if-env-changed=AWS_LC_SYS_EXTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_ASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_CFLAGS
  cargo:rerun-if-env-changed=AWS_LC_SYS_PREBUILT_NASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_C_STD
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  cargo:rerun-if-env-changed=CMAKE
  cargo:warning=Building with: CMake
  cargo:warning=Symbol Prefix: Some("aws_lc_0_23_1")
  cargo:rerun-if-env-changed=CMAKE
  cargo:warning=CMAKE environment variable set: cmake
  cargo:warning=Generating bindings - external bindgen. Platform: aarch64-linux-android

  --- stderr
  Failure invoking external bindgen! External bindgen command failed.
  thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.23.1/builder/main.rs:621:5:
  aws-lc-sys build failed. Please enable the 'bindgen' feature on aws-lc-rs or aws-lc-sys.For more information, see the aws-lc-rs User Guide: https://aws.github.io/aws-lc-rs/index.html
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
note: If the build failed due to a missing target, you can run this command:
note: 
note:     rustup target install aarch64-linux-android
Error: Process completed with exit code 101.

Error: https://github.com/zingolabs/zingo-mobile/actions/runs/12204048367/job/34056737368#step:16:97
bindgen-cli: 0.71.0 (https://github.com/zingolabs/zingo-mobile/actions/runs/12204048367/job/34056737368#step:8:112)

Working: https://github.com/zingolabs/zingo-mobile/actions/runs/12216823690/job/34080355552#step:16:386
bindgen-cli: 0.70.1 (https://github.com/zingolabs/zingo-mobile/actions/runs/12216823690/job/34080355552#step:8:1)

Honestly I don't know what happened, if the problem is about bindgen-cli I'll be happy to open an issue there and close this one. If more info is needed, please let me know.

@justsmth
Copy link
Contributor

justsmth commented Dec 9, 2024

Hello!

  --- stderr
  Failure invoking external bindgen! External bindgen command failed.
  thread 'main' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.23.1/builder/main.rs:621:5:
  aws-lc-sys build failed. Please enable the 'bindgen' feature on aws-lc-rs or aws-lc-sys.For more information, see the aws-lc-rs User Guide: https://aws.github.io/aws-lc-rs/index.html
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

So the build attempted to invoke the (external) bindgen-cli, but apparently couldn't find it in the build environment. bindgen-cli is needed when the (internal) "bindgen" feature of our package has not been enabled (and when the target platform is not one for which we provide pre-generated bindings).

Do you know whether bindgen-cli is installed in the build environment? The following command should ensure that it is:

cargo install --force --locked bindgen-cli

Let us know if bindgen-cli is still failing after it's invoked. There are some other requirements needed for bindgen to run successfully.

@juanky201271
Copy link
Author

Thanks @justsmth

Yes, bindgen-cli is installed in our build env... https://github.com/zingolabs/zingo-mobile/actions/runs/12204048367/job/34056737368#step:8:2

We temporary fixed this problem installing the prior version of bindgen-cli 0.70.1 -> https://github.com/zingolabs/zingo-mobile/actions/runs/12216823690/job/34080359968#step:8:2

@justsmth
Copy link
Contributor

justsmth commented Dec 9, 2024

Thanks for reporting this. bindgen-cli just released v0.71.1 with the following fix: rust-lang/rust-bindgen#3040

I suspect that is the root cause of this build failure.

@juanky201271
Copy link
Author

Thanks for reporting this. bindgen-cli just released v0.71.1 with the following fix: rust-lang/rust-bindgen#3040

I suspect that is the root cause of this build failure.

Thanks, I just saw it, trying now...

@justsmth
Copy link
Contributor

justsmth commented Dec 9, 2024

So prior to bindings generation using bindgen-cli, the build invokes it with --version to verify it's installed and warn users on older versions. If this fails, we assume that bindgen-cli is not available. I think some tweaks to this logic may be needed.

@CBenoit
Copy link

CBenoit commented Dec 9, 2024

Their patch for --version indeed fixed the problem on our side!

@juanky201271
Copy link
Author

Good, works for android cross-compiling, thanks. Closing...

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

No branches or pull requests

3 participants