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 use the crate for the target riscv32i-unknown-none-elf #76

Open
58celep58 opened this issue Feb 16, 2023 · 3 comments
Open

Can't use the crate for the target riscv32i-unknown-none-elf #76

58celep58 opened this issue Feb 16, 2023 · 3 comments

Comments

@58celep58
Copy link

I don't know if this is an issue and I would like to apologize for that. (It is my first issue that i wrote. )

What I did was only include the linked_list_allocator in the Cargo.toml .

/* Cargo.toml */

[dependencies]
linked_list_allocator = "0.10.4"

Terminal Output:

error[E0432]: unresolved import `core::sync::atomic::AtomicUsize`
  --> /home/user123/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.9/src/remutex.rs:19:20
     |
19 |     sync::atomic::{AtomicUsize, Ordering},
     |                    ^^^^^^^^^^^ no `AtomicUsize` in `sync::atomic`

The problem is that the Riscv32i does not contain an atomic instruction set (A) and that is why the error occurs.

I do not know if I have forgotten something or if it is a bug.

@phil-opp
Copy link
Member

Thanks a lot for reporting! See Amanieu/parking_lot#277. Looks like the underlying issue is in rustc: rust-lang/rust#99668.

@phil-opp
Copy link
Member

If you don't need the LockedHeap type, you should be able to work around this issue by disabling the default features in your dependency:

[dependencies]
linked_list_allocator = { version = "0.10.4", default-features = false }

@universal-git
Copy link

Probably it needs a feature from spin for portable_atomic:
https://github.com/mvdnes/spin-rs/tree/master#feature-flags
which allows:
[target.]
rustflags = [ "--cfg", "portable_atomic_unsafe_assume_single_core" ]

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

3 participants