Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Compilation for WASM target fails

Aperta
#450 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust, wasm

Direzione di ricerca

Riproduci il problema con cargo b --features aws_lc_rs --target wasm32-unknown-unknown, quindi esamina la feature in Cargo.toml e le definizioni delle dipendenze specifiche per il target. Confronta il percorso funzionante rust_crypto con aws_lc_rs e verifica se il target può essere compilato correttamente; il lavoro è concluso quando il comando indicato produce una build per il target WASM.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello,

Trying to run:

cargo b --features aws_lc_rs --target wasm32-unknown-unknown

Results in compilation errors:

error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> /home/[email protected]/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.16/src/lib.rs:346:9
    |
346 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
347 | |                         default, you may need to enable the \"js\" feature. \
348 | |                         For more information see: \
349 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `imp`
   --> /home/[email protected]/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.2.16/src/lib.rs:402:9
    |
402 |         imp::getrandom_inner(dest)?;
    |         ^^^ use of unresolved module or unlinked crate `imp`
    |
    = help: if you wanted to use a crate named `imp`, use `cargo add imp` to add it to your `Cargo.toml`

For more information about this error, try `rustc --explain E0433`.

I can confirm that enabling the "js" feature in Cargo.toml:

[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"
getrandom = { version = "0.2", features = ["js"] }

does solve this particular issue for the rust_crypto feature, but not aws_lc_rs.

Is any of this an expected outcome?

Thanks in advance

Lingua principale
Rust
Stelle
2.1k
Fork
367
Merge medio
5g 12h
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Keats/jsonwebtoken

Tutte le issue di Keats/jsonwebtoken

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.