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

Doesn't compile on thumbv6m-none-eabi #903

Closed
chxry opened this issue Jul 25, 2024 · 6 comments
Closed

Doesn't compile on thumbv6m-none-eabi #903

chxry opened this issue Jul 25, 2024 · 6 comments
Labels

Comments

@chxry
Copy link
Contributor

chxry commented Jul 25, 2024

Building latest git version and v1.19.0 fails on thumbv6m-none-eabi with features=["no_std"].
All the errors are from spin using AtomicUsize operations.

error[E0599]: no method named `fetch_add` found for struct `AtomicUsize` in the current scope
   --> /home/chxry/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spin-0.7.1/src/rw_lock.rs:197:31
    |
197 |         let value = self.lock.fetch_add(READER, Ordering::Acquire);
    |                               ^^^^^^^^^ method not found in `AtomicUsize
@schungx
Copy link
Collaborator

schungx commented Jul 26, 2024

Maybe spin locking is not supported for that CPU...

If it isn't supported you may have to clone the repo for the time being and remove the use of the once_cell crate....

EDIT: I find that spin is pulled in by no-std-compat. You can simply disable the spin feature of that crate and see what compiler errors you get -- mostly with trying to set a seed for hashing.

@schungx
Copy link
Collaborator

schungx commented Jul 26, 2024

A bit searching reveals that this problem is quite common on the v6m...

ARM targets with thumbv6m only provide load and store operations, and do not support Compare and Swap (CAS) operations, such as swap , fetch_add , etc.

tokio-rs/bytes#461
https://users.rust-lang.org/t/issue-with-atomicbool-when-trying-to-build-project-for-v6m/59729
fereidani/rclite#7

@schungx schungx added the bug label Jul 26, 2024
@schungx
Copy link
Collaborator

schungx commented Sep 27, 2024

Wonder if you have any success?

@chxry
Copy link
Contributor Author

chxry commented Sep 29, 2024

For me doing this worked, however I haven't tested how this affects other systems.

@schungx
Copy link
Collaborator

schungx commented Sep 30, 2024

This looks interesting. I was not aware of the compat_sync feature. Can you make a PR?

@chxry
Copy link
Contributor Author

chxry commented Oct 3, 2024

Fixed by #919

@chxry chxry closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants