fereidani/rclite

Unable to compile in no_std project

michaelkamprath opened this issue · 2 comments

I am trying to use rclite in a rp2040 project that is no_std. However, the library won't compile:

   Compiling rclite v0.2.4
error[E0599]: no method named `fetch_sub` found for struct `AtomicUsize` in the current scope
   --> /Users/michael/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rclite-0.2.4/src/arc.rs:434:26
    |
434 |         if inner.counter.fetch_sub(1, Ordering::Release) != 1 {
    |                          ^^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_add` found for struct `AtomicUsize` in the current scope
   --> /Users/michael/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rclite-0.2.4/src/arc.rs:592:42
    |
592 |         let count = self.inner().counter.fetch_add(1, Ordering::Relaxed);
    |                                          ^^^^^^^^^ method not found in `AtomicUsize`

error[E0599]: no method named `fetch_sub` found for struct `AtomicUsize` in the current scope
   --> /Users/michael/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rclite-0.2.4/src/arc.rs:609:33
    |
609 |         if self.inner().counter.fetch_sub(1, Ordering::Release) != 1 {
    |                                 ^^^^^^^^^ method not found in `AtomicUsize`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rclite` (lib) due to 3 previous errors

I am using an extern allocator embedded-alloc. Any thoughts on what might be going wrong here?

It seems like your target doesn't support atomic usize operations.

Yeah, this issue seems relevant. The Raspberry Pi Pico (rp2040) is a thumbv6m target.