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

Build failure #1579

Closed
fdubois1 opened this issue Jul 17, 2019 · 7 comments · Fixed by #1581
Closed

Build failure #1579

fdubois1 opened this issue Jul 17, 2019 · 7 comments · Fixed by #1581

Comments

@fdubois1
Copy link

fdubois1 commented Jul 17, 2019

We have a dependency on serde 1.0 so we moved to 1.0.95 and now, we have this issue in our build for Android (It builds for other platforms) :

  error[E0432]: unresolved imports `std::sync::atomic::AtomicI64`, `std::sync::atomic::AtomicU64`
     --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.95/src/lib.rs:221:33
  
  221 |     pub use std::sync::atomic::{AtomicI64, AtomicU64};
                                   ^^^^^^^^^  ^^^^^^^^^ no `AtomicU64` in `sync::atomic`
                                   |
                                   no `AtomicI64` in `sync::atomic`
  help: a similar name exists in the module
  
  221 |     pub use std::sync::atomic::{AtomicI8, AtomicU64};
                                   ^^^^^^^^
  help: a similar name exists in the module
  
  221 |     pub use std::sync::atomic::{AtomicI64, AtomicU8};
                                              ^^^^^^^^
  
  error: aborting due to previous error

I thought I had an old version of rust, but I'm using 1.35.0 so I don't understand why AtomicI64 is not found. Any hint ? Thanks for your help

@tymcauley
Copy link

tymcauley commented Jul 17, 2019

I just ran into this exact same issue. It appears this is new in 1.0.95 (I can't reproduce it in 1.0.94). I've only noticed this issue for the mips-unknown-linux-gnu and mips-unknown-linux-musl targets (works fine on x86_64 targets). You can reproduce this by creating the serde test crate from this repo's homepage (the simple JSON serde example), and running these commands:

rustup target add mips-unknown-linux-gnu
rustup target add mips-unknown-linux-musl
cargo build --target mips-unknown-linux-gnu
cargo build --target mips-unknown-linux-musl

Both of those cargo build commands should fail with the same signature mentioned above, while a vanilla cargo build for an x86_64 target will succeed.

@fdubois1
Copy link
Author

In my case, I didn't specify the exact target, but it is --target arm-linux-androideabi

@Roguelazer
Copy link
Contributor

Hm. The documentation does include the following line:

MIPS and PowerPC do not support AtomicU64, and "more esoteric" platforms like armv5te, thumv6m, etc, have little-to-no support.

It looks like the relevant cfg flag never got merged (rust-lang/rust#56753).

For now, do y'all want to just gate this feature on x86/x86_64 in the build.rs script so we stop breaking MIPS and ARM?

@fdubois1
Copy link
Author

Thank you for your answer. Yeah, I think it make sense to gate the feature to stop breaking the build with some target. It is better to remove the feature than getting a build error I think...

@Roguelazer
Copy link
Contributor

okay I'll send over a PR in a minute

@dtolnay
Copy link
Member

dtolnay commented Jul 17, 2019

Sorry about the breakage! I've yanked serde 1.0.95, so cargo should start giving you 1.0.94 which doesn't have those impls.

Ideally we would use #[cfg(target_has_atomic = "64")] but it isn't stable yet. We can try to do a whitelist of platforms that are known to have AtomicU64 instead.

@fdubois1
Copy link
Author

Thank you, it works and use version 1.0.94.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants