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

unable to build for some platforms that does not support AtomicU64 #462

Closed
delta4chat opened this issue Oct 31, 2024 · 1 comment · Fixed by #480
Closed

unable to build for some platforms that does not support AtomicU64 #462

delta4chat opened this issue Oct 31, 2024 · 1 comment · Fixed by #480

Comments

@delta4chat
Copy link

because moka internally uses some 64-bit atomic types from standard library, but it is not found in some 32-bit processors.
you can use portable-atomic for support these platforms.

https://docs.rs/portable-atomic

cargo add moka --no-default-features -F future,logging,atomic64,quanta

cross build --release --target mipsel-unknown-linux-musl

error[E0432]: unresolved import "std::sync::atomic::AtomicU64"
 --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/moka-0.12.8/src/common/concurrent/atomic_time/atomic_time.rs:5:20
  |
5 |     sync::atomic::{AtomicU64, Ordering},
  |                    ^^^^^^^^^
  |                    |
  |                    no "AtomicU64" in "sync::atomic"
  |                    help: a similar name exists in the module: "AtomicU32"
@tatsuya6502
Copy link
Member

tatsuya6502 commented Jan 4, 2025

Sorry for a late response. I was sick and could not participate OSS activities for almost a half year.

you can use portable-atomic for support these platforms.

https://docs.rs/portable-atomic

Thanks for the information! I will consider it for a future release.

I once tried crossbeam::atomic::AtomicCell<u64> in 2021, when portable-atomic did not exist (#41). portable-atomic is written by the same author of crossbeam::atomic::*, and it seems to be more suitable for our use case.

As for now (moka v0.12.8 and v0.12.9), I hope you already found the workaround for this issue. It is described in the Troubleshooting section of v0.12.8 README.

[dependencies]
moka = { version = "0.12", default-features = false, features = ["sync"] }
# Or
moka = { version = "0.12", default-features = false, features = ["future"] }

We just released v0.12.9 with a bit better workaround #466. But again, I will consider portable-atomic for a future release. Thanks for the suggestion!

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

Successfully merging a pull request may close this issue.

2 participants