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

Error compiling on armv5tel architecture #475

Closed
lscorcia opened this issue Aug 28, 2022 · 5 comments · Fixed by #484
Closed

Error compiling on armv5tel architecture #475

lscorcia opened this issue Aug 28, 2022 · 5 comments · Fixed by #484

Comments

@lscorcia
Copy link

Hi, totally a rust noob so I apologize if I'm misreading what the rust compiler is telling me.
I'm trying to build homeassistant on an embedded armv5tel NAS (32-bit). I'm stuck at building maturin, which requires indicatif v0.17.0. While building, I get the following error:

error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
 --> /home/homeassistant/.cargo/registry/src/github.com-1285ae84e5963aae/indicatif-0.17.0/src/state.rs:2:25
  |
2 | use std::sync::atomic::{AtomicU64, AtomicU8, Ordering};
  |                         ^^^^^^^^^
  |                         |
  |                         no `AtomicU64` in `sync::atomic`
  |                         help: a similar name exists in the module: `AtomicU8`

For more information about this error, try `rustc --explain E0432`.
error: failed to compile `maturin v0.13.2 (/home/homeassistant/maturin)`, intermediate artifacts can be found at `/home/homeassistant/maturin/target`

Caused by:
  could not compile `indicatif` due to previous error

Some info about my environment:

(homeassistant) homeassistant@nsa325:~/maturin$ rustc --version
rustc 1.59.0
(homeassistant) homeassistant@nsa325:~/maturin$ cargo --version
cargo 1.56.0
(homeassistant) homeassistant@nsa325:~/maturin$ uname -a
Linux nsa325 5.15.5-kirkwood-tld-1 #1.0 PREEMPT Sun Nov 28 23:08:13 PST 2021 armv5tel GNU/Linux
(homeassistant) homeassistant@nsa325:~/maturin$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

It seems like AtomicU64 is not defined on all architectures (I've seen similar reports for PowerPC, i.e. tikv/rust-prometheus#315). Can you please provide a fix/workaround?

@djc
Copy link
Collaborator

djc commented Aug 29, 2022

Ah yeah, so we're using AtomicU64 which apparently your target doesn't have. I'd be open to polyfilling that with a Mutex<u64> somehow but I probably won't be motivated to write that code myself.

@lscorcia
Copy link
Author

I've been able to continue the compilation process by patching indicatif to use atomic-shim, but I had to slightly alter that in order to support the arm platform. Later I found out about https://docs.rs/tokio/0.2.4/src/tokio/loom/std/atomic_u64.rs.html which seems simpler, but already includes the arm platform.
Could you borrow the implementation from those?

@djc
Copy link
Collaborator

djc commented Aug 29, 2022

The loom is an internal implementation detail for Tokio that is used to help them test. Relying on atomic-shim for these platforms seems correct, probably submit a PR their way to add arm support?

@lscorcia
Copy link
Author

Sent PR at bltavares/atomic-shim#5 . Let's wait and see!

@messense
Copy link
Contributor

messense commented Oct 4, 2022

Opened #484 to use portable-atomic.

messense added a commit to rust-cross/cargo-xwin that referenced this issue Oct 9, 2022
Fix build on some 32-bit platforms caused by console-rs/indicatif#475

* Reverts 377aa75
* Reverts 310463f
messense added a commit to rust-cross/cargo-xwin that referenced this issue Oct 9, 2022
Fix build on some 32-bit platforms caused by console-rs/indicatif#475

* Reverts 377aa75
* Reverts 310463f
@djc djc closed this as completed in #484 Oct 10, 2022
orhun added a commit to orhun/rustypaste-cli that referenced this issue Dec 31, 2022
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.

3 participants