Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-crypto breaks cargo build --target wasm32-wasi #1758

Closed
MikeCamel opened this issue May 26, 2020 · 3 comments
Closed

rust-crypto breaks cargo build --target wasm32-wasi #1758

MikeCamel opened this issue May 26, 2020 · 3 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@MikeCamel
Copy link

Following instructions from here:https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md

  • What are the steps to reproduce the issue?
    Add the following to Cargo.toml:
[dependencies]
rust-crypto = "0.2.36"
  • What do you expect to happen? What does actually happen? Does it panic, and
    if so, with which assertion?
    I expect a normal compilation ("cargo build" works fine with no "--target")
    This is what I get:
[mbursell@redz1 test-n-try]$ cargo build --target wasm32-wasi --verbose
       Fresh gcc v0.3.55
       Fresh rand v0.4.6
   Compiling rustc-serialize v0.3.24
     Running `rustc --crate-name rustc_serialize /home/mbursell/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=81dd7fcdc8fa060f -C extra-filename=-81dd7fcdc8fa060f --out-dir /home/mbursell/work/programming/rust/projects/test-n-try/target/wasm32-wasi/debug/deps --target wasm32-wasi -L dependency=/home/mbursell/work/programming/rust/projects/test-n-try/target/wasm32-wasi/debug/deps -L dependency=/home/mbursell/work/programming/rust/projects/test-n-try/target/debug/deps --cap-lints allow`
   Compiling rust-crypto v0.2.36
       Fresh libc v0.2.71
       Fresh rand v0.3.23
       Fresh time v0.1.43
     Running `rustc --crate-name build_script_build /home/mbursell/.cargo/registry/src/github.com-1ecc6299db9ec823/rust-crypto-0.2.36/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=7f2ee95fb96eec39 -C extra-filename=-7f2ee95fb96eec39 --out-dir /home/mbursell/work/programming/rust/projects/test-n-try/target/debug/build/rust-crypto-7f2ee95fb96eec39 -L dependency=/home/mbursell/work/programming/rust/projects/test-n-try/target/debug/deps --extern gcc=/home/mbursell/work/programming/rust/projects/test-n-try/target/debug/deps/libgcc-4bc2c35f0d7340fa.rlib --cap-lints allow`
     Running `/home/mbursell/work/programming/rust/projects/test-n-try/target/debug/build/rust-crypto-7f2ee95fb96eec39/build-script-build`
error[E0046]: not all trait items implemented, missing: `encode`
    --> /home/mbursell/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1
     |
853  |     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>;
     |     ---------------------------------------------------------------- `encode` from trait
...
1358 | impl Encodable for path::Path {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `encode` in implementation

error[E0046]: not all trait items implemented, missing: `decode`
    --> /home/mbursell/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1382:1
     |
904  |     fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;
     |     ----------------------------------------------------------- `decode` from trait
...
1382 | impl Decodable for path::PathBuf {
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `decode` in implementation

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0046`.
error: could not compile `rustc-serialize`.

Caused by:
  process didn't exit successfully: `rustc --crate-name rustc_serialize /home/mbursell/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=81dd7fcdc8fa060f -C extra-filename=-81dd7fcdc8fa060f --out-dir /home/mbursell/work/programming/rust/projects/test-n-try/target/wasm32-wasi/debug/deps --target wasm32-wasi -L dependency=/home/mbursell/work/programming/rust/projects/test-n-try/target/wasm32-wasi/debug/deps -L dependency=/home/mbursell/work/programming/rust/projects/test-n-try/target/debug/deps --cap-lints allow` (exit code: 1)

  • Which Wasmtime version / commit hash / branch are you using?
[mbursell@redz1 test-n-try]$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/mbursell/.rustup

installed targets for active toolchain
--------------------------------------

wasm32-wasi
x86_64-unknown-linux-gnu

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.43.1 (8d69840ab 2020-05-04)


  • If relevant, can you include some extra information about your environment?
    (Rust version, operating system, architecture...)
@MikeCamel MikeCamel added the bug Incorrect behavior in the current implementation that needs fixing label May 26, 2020
@bjorn3
Copy link
Contributor

bjorn3 commented May 26, 2020

rust-crypto seems to not support wasm: DaGenix/rust-crypto#437 (comment). The author of that comment has forked it to add wasm support: https://github.com/buttercup/rust-crypto-wasm. Also the last update of rust-crypto was in 2016. The last update of the fork was in 2018. Consider using a different crypto library.

@MikeCamel
Copy link
Author

I've updated to rust-crypto-wasm v.0.3.1, and all compiles! Thank you.

-Mike.

@sunfishcode
Copy link
Member

It should be noted that rust-crypto-wasm uses compiled implementations of secure_memset and fixed_time_eq which when compiled to wasm are not guaranteed to uphold the "secure" or "fixed_time" parts of their respective names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

No branches or pull requests

3 participants