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

support no_std #80

Closed
yeti-g opened this issue Dec 9, 2021 · 3 comments · Fixed by #105
Closed

support no_std #80

yeti-g opened this issue Dec 9, 2021 · 3 comments · Fixed by #105
Labels
enhancement New feature or request

Comments

@yeti-g
Copy link

yeti-g commented Dec 9, 2021

It would be very nice to support environments without standard library. Embedded devices like target=thumbv6m-none-eabi need no_std

$ cargo build --no-default-features --features pure --target=thumbv6m-none-eabi
   Compiling subtle v2.4.1
   Compiling base64 v0.13.0
   Compiling getrandom v0.2.3
   Compiling generic-array v0.14.4
   Compiling serde v1.0.131
error[E0463]: can't find crate for `std`
  --> /.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:88:1
   |
88 | extern crate std;
   | ^^^^^^^^^^^^^^^^^ can't find crate
   |
   = note: the `thumbv6m-none-eabi` target may not support the standard library

error[E0463]: can't find crate for `std`
 --> /.cargo/registry/src/github.com-1ecc6299db9ec823/getrandom-0.2.3/src/error_impls.rs:9:1
  |
9 | extern crate std;
  | ^^^^^^^^^^^^^^^^^ can't find crate
  |
  = note: the `thumbv6m-none-eabi` target may not support the standard library

For more information about this error, try `rustc --explain E0463`.
error: could not compile `subtle` due to previous error
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv6m-none-eabi` target may not support the standard library
  = note: `std` is required by `base64` because it does not declare `#![no_std]`

error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv6m-none-eabi` target may not support the standard library
  = note: `std` is required by `serde` because it does not declare `#![no_std]`

error: build failed
@kigawas kigawas added the enhancement New feature or request label Dec 9, 2021
@kigawas
Copy link
Member

kigawas commented Dec 9, 2021

Can you try this branch? https://github.com/ecies/rs/tree/no-std

I'm not sure if it can work, but it compiles on thumbv6m-none-eabi

@yeti-g
Copy link
Author

yeti-g commented Dec 23, 2021

Nice progress and a very cool project! I cannot test in my environment due to no heap memory or alloc support but you could probably close this issue as I took another approach to encryption in my embedded project. Fwiw I'm using Heapless::Vec in the project and it could be an easy change here if you choose to expand support for embedded devices.

@kigawas
Copy link
Member

kigawas commented Jul 24, 2023

I've almost finished adding no_std support, but the random generator is a problem. Only targets below are supported and unfortunately thumbv6m-none-eabi is not one of them 😢

https://docs.rs/getrandom/latest/getrandom/#supported-targets

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

Successfully merging a pull request may close this issue.

2 participants