rust-cargo

Why does `cargo build` fail to run custom build command for `stdint v1.0.0`?


I'm trying to compile a keypad driver written in Rust by using cargo build, but I get a strange error message I can't find any information about:

╭─jacek@epica /import/valen/autoradio/libkeypad  
╰─➤  cargo build                                     
   Compiling proc-macro2 v1.0.103
   Compiling clang-sys v1.8.1
   Compiling regex v1.12.2
   Compiling cexpr v0.6.0
   Compiling libc v0.2.177
   Compiling bitflags v1.3.2
   Compiling cfg-if v1.0.4
   Compiling anyhow v1.0.100
   Compiling bitflags v2.10.0
   Compiling byteorder v1.5.0
   Compiling which v4.4.2
   Compiling bindgen v0.69.5
   Compiling quote v1.0.41
   Compiling nix v0.26.4
   Compiling syn v2.0.108
   Compiling i2cdev v0.6.1
   Compiling prettyplease v0.2.37
   Compiling atomic_enum v0.3.0
   Compiling stdint v1.0.0
error: failed to run custom build command for `stdint v1.0.0`

Caused by:
  process didn't exit successfully: `/import/valen/autoradio/libkeypad/target/debug/build/stdint-19ddd44c74745eb0/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=src/c99.h
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_armv7-unknown-linux-musleabihf
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_armv7_unknown_linux_musleabihf
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=src/c99.h

  --- stderr
  /usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found

  thread 'main' (13040) panicked at /home/jacek/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/stdint-1.0.0/build.rs:24:39:
  Unable to generate bindings: ClangDiagnostic("/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found\n")
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm afraid that the culprit is the missing gnu/stubs-32.h file, but I have no clue on where to get it. If it was a part of the Rust programming system, it would have been installed automatically, I suppose. And: Is that a 32-bit header? My workstation is using a 64-bit version of OpenSuSE 15.6.


Solution

  • OK, I found out that there is in fact a 32-bit Glibc developer package missing for whatever reason, so installing it helped:

    ╭─jacek@epica /import/valen/autoradio/libkeypad  
    ╰─➤  sudo zypper in glibc-devel-32bit                                     101 ↵