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

no_std-targeted build fails, getrandom dependency uses std #112

Closed
alt3r-3go opened this issue Aug 30, 2021 · 2 comments
Closed

no_std-targeted build fails, getrandom dependency uses std #112

alt3r-3go opened this issue Aug 30, 2021 · 2 comments

Comments

@alt3r-3go
Copy link

Hello everyone,
Looking at #22, I'd expect to be able to build the library for no_std target, but this currently failson getrandom like this:

$> cargo build --target thumbv7em-none-eabihf
   Compiling getrandom v0.2.3
   Compiling typenum v1.13.0
error[E0463]: can't find crate for `std`
 --> /home/user/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/getrandom-0.2.3/src/error_impls.rs:9:1
  |
9 | extern crate std;
  | ^^^^^^^^^^^^^^^^^ can't find crate
  |
  = note: the `thumbv7em-none-eabihf` target may not support the standard library

Is this expected to build at all, or things (e.g. your approach to supporting no_std) have changed since #22?

@alt3r-3go alt3r-3go changed the title no_std-targeted build fails, getrandom dependency uses std no_std-targeted build fails, getrandom dependency uses std Aug 30, 2021
@robin-nitrokey
Copy link

As far as I understand, all dependencies that require std are behind the std feature (which is enabled by default). So compilation should work with cargo build --target thumbv7em-none-eabihf --no-default-features --features alloc. (alloc is required, see #51.)

@alt3r-3go
Copy link
Author

Indeed, that was the reason, I apparently scanned the Cargo.toml too quickly and setting the features like that does compile fine. Thanks!

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

2 participants