-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Using no_std on thumbv6m-none-eabi #718
Comments
Can you share your Cargo.toml configuration for dfdx? For no-std you should have both of these:
If both of those are true this seems like a regression for no-std. We have a CI pipeline that's supposed to check for no-std support but there could be a bug with it |
Yes, both are true. Apparently, it is an specific problem with the In my particular case, I just want to do inference (loading a model at compile time), so no sync would be needed (single thread). No idea how difficult or useful would be to have an |
Ahhh I see - it seems like something we could fix by enabling the |
Maybe... Also, not sure what the deal would be with |
Hmm yeah adding portable_atomics addresses one compilation issue, but then I start getting these very weird errors: error[E0463]: can't find crate for `core`
--> C:\Users\clowm\.cargo\registry\src\index.crates.io-6f17d22bba15001f\libm-0.2.1\src\math\tgamma.rs:25:1
|
25 | extern crate core;
| ^^^^^^^^^^^^^^^^^^ can't find crate
|
= note: the `thumbv6m-none-eabi` target may not be installed
= help: consider downloading the target with `rustup target add thumbv6m-none-eabi`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error[E0463]: can't find crate for `core`
--> C:\Users\clowm\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rand_core-0.6.3\src\lib.rs:41:5
|
41 | use core::convert::AsMut;
| ^^^^ can't find crate
|
= note: the `thumbv6m-none-eabi` target may not be installed
= help: consider downloading the target with `rustup target add thumbv6m-none-eabi`
= help: consider building the standard library from source with `cargo build -Zbuild-std` I definitely have |
Do you know of no_std crates that compile successfully for this target architecture? We might be able to copy the configuration from there |
I'm using:
|
Got it thanks! So it looks like with some feature wrangling I was able to reduce the issues I was seeing, and now am just encountering issues with spin. I created an issue on their repo asking for more info here mvdnes/spin-rs#151. |
Thanks mate. I tried what they suggested (portable_atomic_unsafe_assume_single_core) but it didn't work either... I don't remember the error but I will post it when I get to work. |
This is the final error I'm getting with the fixes for the target: error[E0432]: unresolved import `__alloc::sync`
--> C:\Users\clowm\.cargo\registry\src\github.com-1ecc6299db9ec823\no-std-compat-0.4.1\src\generated.rs:173:48
|
173 | #[cfg(feature = "alloc")] pub use __alloc::sync::*;
| ^^^^ could not find `sync` in `__alloc` Which is with This is with an empty project with Cargo.toml: [package]
name = "no-std-test"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dfdx = { path = "../dfdx", default-features = false, features = ["no-std"]} and .cargo/config:
Command to build is:
|
Yes... that was the error. |
Found a related issue on no-std-compat https://gitlab.com/jD91mZM2/no-std-compat/-/issues/6 |
Okay so I tested out on the main branch of no-std-compat with this dependency: no-std-compat = { git = "https://gitlab.com/jD91mZM2/no-std-compat.git", branch = "master", default-features = false, features = [ "alloc", "compat_hash" ], optional = true } This addresses the above error, but it seems like it doesn't include std::sync at all (see errors below). I'm not sure what this means for compiling dfdx on this target. 🤔 error[E0432]: unresolved import `std::sync::Arc`
--> C:\Users\clowm\Documents\programming\dfdx\src\optim\adam\mod.rs:6:32
|
6 | use std::{marker::PhantomData, sync::Arc};
| ^^^^^^^^^ no `Arc` in `generated::sync`
error[E0432]: unresolved import `std::sync::Arc`
--> C:\Users\clowm\Documents\programming\dfdx\src\optim\rmsprop\mod.rs:6:32
|
6 | use std::{marker::PhantomData, sync::Arc};
| ^^^^^^^^^ no `Arc` in `generated::sync`
error[E0432]: unresolved import `std::sync::Arc`
--> C:\Users\clowm\Documents\programming\dfdx\src\tensor\cpu\allocate.rs:11:11
|
11 | use std::{sync::Arc, vec::Vec};
| ^^^^^^^^^ no `Arc` in `generated::sync` |
I think we may be able to get aroudn this with no-std-compat's "compat_sync" feature, which adds std::sync bindings. However it is currently using a very old version of spin (0.7.0) |
Could you make |
No this is a known issue in the no-std-compat crate: https://gitlab.com/jD91mZM2/no-std-compat/-/issues/6 |
I'm trying to use this awesome library for an embedded project (just inference) but I'm having problems compiling it.
I tried to run
cargo build -Zbuild-std
as suggested by I still get the error:It's probably a misconfiguration from my part but I was wondering if you have any suggestions. Thanks!
@antimora (I saw you in some of the
no_std
related issues 😄)The text was updated successfully, but these errors were encountered: