mozilla / mozilla/authenticator-rs

Please add instructions on how to use bindgen

Open
#348 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
316
Forks
82
Avg merge
4d 20h
Merged PRs (30d)
1

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading build.rs and the binding-recompile feature path, then compare the architecture selection with the generated bindings used by src/transport/linux/hidraw.rs. Document the commands and files needed to add a new architecture with bindgen, including how to verify that the generated bindings provide the required symbols and that cargo build --features binding-recompile succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.