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

Some 32 bit platforms are not supported #201

Closed
navaati opened this issue Jun 25, 2024 · 6 comments · Fixed by #203
Closed

Some 32 bit platforms are not supported #201

navaati opened this issue Jun 25, 2024 · 6 comments · Fixed by #203

Comments

@navaati
Copy link
Contributor

navaati commented Jun 25, 2024

I’m trying to use this library on a 32-bit platform (an ESP32-C3 chip, RISC-V based, has alloc and std).

However when building I get this error:

$ cargo check
    Checking prometheus-client v0.22.2
error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
  --> /home/navaati/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-client-0.22.2/src/metrics/counter.rs:10:5
   |
10 | use std::sync::atomic::AtomicU64;
   |     ^^^^^^^^^^^^^^^^^^^---------
   |     |                  |
   |     |                  help: a similar name exists in the module: `AtomicU32`
   |     no `AtomicU64` in `sync::atomic`

error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
  --> /home/navaati/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-client-0.22.2/src/metrics/exemplar.rs:17:5
   |
17 | use std::sync::atomic::AtomicU64;
   |     ^^^^^^^^^^^^^^^^^^^---------
   |     |                  |
   |     |                  help: a similar name exists in the module: `AtomicU32`
   |     no `AtomicU64` in `sync::atomic`

error[E0432]: unresolved imports `std::sync::atomic::AtomicI64`, `std::sync::atomic::AtomicU64`
  --> /home/navaati/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prometheus-client-0.22.2/src/metrics/gauge.rs:11:25
   |
11 | use std::sync::atomic::{AtomicI64, AtomicU64};
   |                         ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
   |                         |
   |                         no `AtomicI64` in `sync::atomic`

My platform doesn’t support 64 bit atomics. Would there be a way to drop down to 32 bit atomics, perhaps with config detections, or a feature flag ?

@navaati
Copy link
Contributor Author

navaati commented Jun 25, 2024

Ah ! I realize it is actually supported, just for certain listed platforms:

#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
use std::sync::atomic::AtomicU64;

I’ll make a PR for ESPs.

@navaati navaati changed the title 32 bit platforms are not supported Some 32 bit platforms are not supported Jun 25, 2024
@navaati
Copy link
Contributor Author

navaati commented Jun 25, 2024

Related previous PRs: #37 #42 .

@navaati
Copy link
Contributor Author

navaati commented Jun 25, 2024

#202 is a narrow fix, but I’d like a more general solution using target_has_atomic which is meant for this. Can still be merged in the meantime though.

@navaati
Copy link
Contributor Author

navaati commented Jun 25, 2024

#203 is the better fix but a bit of a bigger change (and I have not tested for regular PC class platforms, but I guess CI will).

@navaati
Copy link
Contributor Author

navaati commented Jun 29, 2024

Hi @mxinden, can you take a look at the PR for this ? It’s pretty simple. Even better if you can also look at related #206 :).

@zestysoft
Copy link

I just ran into this too -- in my case it's an armv5 system. https://github.com/rp-/tigo-exporter/issues/3

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