Skip to content

Please add instructions on how to use bindgen #348

@glaubitz

Description

@glaubitz

I tried to add support for sparc64 by running cargo build --features binding-recompile after adding sparc64 to the list of architectures:

glaubitz@stadler:~/authenticator-rs$ git diff
diff --git a/build.rs b/build.rs
index acc4f09..a9b36c9 100644
--- a/build.rs
+++ b/build.rs
@@ -49,6 +49,8 @@ fn main() {
         "ioctl_riscv64.rs"
     } else if cfg!(all(target_arch = "loongarch64", target_endian = "little")) {
         "ioctl_loongarch64.rs"
+    } else if cfg!(all(target_arch = "sparc64", target_endian = "big")) {
+        "ioctl_sparc64.rs"
     } else {
         panic!("architecture not supported");
     };
glaubitz@stadler:~/authenticator-rs$

However, trying to build the binding-recompile feature did not work:

(sid_sparc64-dchroot)glaubitz@stadler:~/authenticator-rs$ cargo build --features binding-recompile
   Compiling authenticator v0.4.1 (/home/glaubitz/authenticator-rs)
error[E0432]: unresolved imports `super::hidwrapper::_HIDIOCGRDESC`, `super::hidwrapper::_HIDIOCGRDESCSIZE`
  --> src/transport/linux/hidraw.rs:11:25
   |
11 | use super::hidwrapper::{_HIDIOCGRDESC, _HIDIOCGRDESCSIZE};
   |                         ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^ no `_HIDIOCGRDESCSIZE` in `transport::platform::hidwrapper`
   |                         |
   |                         no `_HIDIOCGRDESC` in `transport::platform::hidwrapper`

warning: unexpected `cfg` condition name: `fuzzing`
   --> src/lib.rs:110:7
    |
110 | #[cfg(fuzzing)]
    |       ^^^^^^^
    |
    = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
    = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(fuzzing)");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

warning: unexpected `cfg` condition name: `fuzzing`
   --> src/lib.rs:112:7
    |
112 | #[cfg(fuzzing)]
    |       ^^^^^^^
    |
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
    = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(fuzzing)");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `cargo-clippy`
 --> src/transport/hidproto.rs:8:5
  |
8 |     feature = "cargo-clippy",
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: expected values for `feature` are: `bindgen`, `binding-recompile`, `bytes`, `crypto_dummy`, `crypto_nss`, `crypto_openssl`, `default`, `gecko`, `nss-gk-api`, `openssl`, `openssl-sys`, and `pkcs11-bindings`
  = help: consider adding `cargo-clippy` as a feature in `Cargo.toml`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

warning: unexpected `cfg` condition value: `cargo-clippy`
 --> src/transport/linux/hidraw.rs:4:13
  |
4 | #![cfg_attr(feature = "cargo-clippy", allow(clippy::cast_lossless))]
  |             ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: expected values for `feature` are: `bindgen`, `binding-recompile`, `bytes`, `crypto_dummy`, `crypto_nss`, `crypto_openssl`, `default`, `gecko`, `nss-gk-api`, `openssl`, `openssl-sys`, and `pkcs11-bindings`
  = help: consider adding `cargo-clippy` as a feature in `Cargo.toml`
  = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration

For more information about this error, try `rustc --explain E0432`.
warning: `authenticator` (lib) generated 4 warnings
error: could not compile `authenticator` (lib) due to 1 previous error; 4 warnings emitted
(sid_sparc64-dchroot)glaubitz@stadler:~/authenticator-rs

Could you please add instructions on how to use bindgen to add a new architecture?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions