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

Can't build in no_std environment #204

Closed
ethindp opened this issue Aug 26, 2019 · 6 comments
Closed

Can't build in no_std environment #204

ethindp opened this issue Aug 26, 2019 · 6 comments

Comments

@ethindp
Copy link

ethindp commented Aug 26, 2019

The latest crates.io build no longer works with the core feature. num-traits is required by one of the dependent crates or by wasmi itself, and the std feature is not turned off, causing E0463 ("can't find crate for std"). This is how I'm including it:

wasmi = {version = "*", default-features=false, features=["core"]}
@pepyakin
Copy link
Collaborator

That's interesting, did you use nightly? What is the error?

@gui1117
Copy link
Contributor

gui1117 commented Aug 27, 2019

This seems to be solved on master but not on version in crate.io

[thiolliere@localhost ressai]$ cargo +nightly check --no-default-features 
   Compiling byteorder v1.3.2
    Checking parity-wasm v0.31.3
    Checking hashbrown v0.1.8
    Checking wasmi-validation v0.1.0
    Checking wasmi v0.5.0
error[E0433]: failed to resolve: maybe a missing crate `std`?
 --> /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmi-0.5.0/src/memory/mmap_bytebuf.rs:8:5
  |
8 | use std::ptr::{self, NonNull};
  |     ^^^ maybe a missing crate `std`?

error[E0432]: unresolved import `std`
 --> /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmi-0.5.0/src/memory/mmap_bytebuf.rs:8:5
  |
8 | use std::ptr::{self, NonNull};
  |     ^^^ maybe a missing crate `std`?

error[E0432]: unresolved import `std`
 --> /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmi-0.5.0/src/memory/mmap_bytebuf.rs:9:5
  |
9 | use std::slice;
  |     ^^^ maybe a missing crate `std`?

error[E0433]: failed to resolve: use of undeclared type or module `NonNull`
  --> /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmi-0.5.0/src/memory/mmap_bytebuf.rs:66:27
   |
66 |                 let ptr = NonNull::new(ptr_or_err as *mut u8).ok_or("mmap returned 0")?;
   |                           ^^^^^^^ use of undeclared type or module `NonNull`

error[E0412]: cannot find type `NonNull` in this scope
  --> /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmi-0.5.0/src/memory/mmap_bytebuf.rs:15:10
   |
15 |     ptr: NonNull<u8>,
   |          ^^^^^^^ not found in this scope
help: possible candidate is found in another module, you can import it into scope
   |
8  | use core::ptr::NonNull;
   |

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: Could not compile `wasmi`.

@ethindp
Copy link
Author

ethindp commented Aug 27, 2019 via email

@pepyakin
Copy link
Collaborator

Ah, this can be solved by using the vec_memory feature. However, I am not sure why, I believe that it should be enabled automatically if compiled for no_std

@tomaka
Copy link
Contributor

tomaka commented Nov 24, 2019

This issue is still relevant and is blocked on rust-num/num-bigint#96.

@pepyakin
Copy link
Collaborator

I think this should be fixed with #230.

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

No branches or pull requests

4 participants