Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Unable to compile with 'cargo web build' #12

Open
godadada opened this issue Apr 3, 2019 · 6 comments
Open

Unable to compile with 'cargo web build' #12

godadada opened this issue Apr 3, 2019 · 6 comments

Comments

@godadada
Copy link

godadada commented Apr 3, 2019

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
Copy link
Owner

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
Copy link
Author

godadada commented Apr 4, 2019

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

Thanks

@abonander
Copy link
Owner

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
Copy link
Author

godadada commented Apr 6, 2019

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
Copy link
Owner

Try doing the same with your dependency on rpgp.

@godadada
Copy link
Author

godadada commented Apr 7, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants