No matching package named 'clap' found while building with Yocto – why does cargo build can’t find the crate?

⚓ Rust    📅 2026-06-18    👤 surdeus    👁️ 3      

surdeus

I have a Rust binary that depends on the clap and nix crates.
My Cargo.toml looks like this:

[package]
name = "argumentParser"
version = "0.1.0"
edition = "2024"

[dependencies]
clap    = { version = "4.6.1", features = ["derive"] }
nix     = { version = "0.31.3", features = ["ioctl"] }

When Yocto scarthgap runs cargo build --release I get the following error:

error: no matching package named `clap` found
location searched: registry `crates-io`
required by package `argumentParser v0.1.0 (/mnt/data/poky/build/tmp/work/... )`

The question is why Cargo cannot locate the clap crate and how to make Yocto’s Rust target able to fetch it.

1 post - 1 participant

Read full topic

🏷️ Rust_feed