abonander / buf_redux

A drop-in replacement for Rust's std::io::BufReader, with extra features
Apache License 2.0
38 stars 16 forks source link

Unable to compile with 'cargo web build' #12

Open godadada opened 5 years ago

godadada commented 5 years ago

I have a web client rust app that needs stdweb crate which uses 'cargo web build' subcommand. Also the app dependency chain needs buf_redux crate. The 'cargo web build' causes error when building bug_redux. The error is message is below. Please advice how to resolve the issue:

cargo/registry/src/github.com-1ecc6299db9ec823/buf_redux-0.8.1 dude@ubuntu:~/.cargo/registry/src/github.com-1ecc6299db9ec823/buf_redux-0.8.1$ cargo web build Compiling safemem v0.2.0 Compiling memchr v2.2.0 Compiling buf_redux v0.8.1 (/home/dude/.cargo/registry/src/github.com-1ecc6299db9ec823/buf_redux-0.8.1) error[E0463]: can't find crate for slice_deque --> src/buffer/slice_deque_buf.rs:14:1 | 14 | extern crate slice_deque; | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate error: aborting due to previous error For more information about this error, try rustc --explain E0463. error: Could not compile buf_redux.

To learn more, run the command again with --verbose. error: build failed

abonander commented 5 years ago

This is because slice_deque doesn't support building for WASM. I'll need to fix that.

In the meantime, try cargo web build --no-default-features.

godadada commented 5 years ago

I tried the command with the new option, got same error. Could you share any schedule that WASM support may be available?

Thanks

abonander commented 5 years ago

Sorry, you actually need to set default-features = false for the buf_redux dependency in your Cargo.toml:

# before 
buf_redux = "0.8"

# after
buf_redux = { version = "0.8", default-features = false }

It should be a trivial fix but I need to install cargo-web to test it, I haven't gotten around to it yet.

godadada commented 5 years ago

My program uses rpgp which depends on buf_redux. I see in rpgp's Cargo.toml file having following entries:

[dependencies.buf_redux] version = "0.8.1" default-features = false ..... [features] default = ["ringbuf"] ringbuf = ["buf_redux/default"]

I do not know if I can change my App's Cargo.toml to have any impact, but tried anyway with same error.

please advise.

abonander commented 5 years ago

Try doing the same with your dependency on rpgp.

godadada commented 5 years ago

Okay. That nailed it. In case anyone else has similar issue, I used following entry in Cargo.toml:

pgp = { version = "*", default-features = false }

Thanks again.