Skip to content

Compilation error on platforms that do not have AtomicU32 from #896 #908

Closed
@allanlw

Description

@allanlw

I hope this is the correct place to file this issue, I'm not too familiar with rust internals.

The recent change #896 adds an import for AtomicU32, but this is not available on the "bpfel-unknown-none" target. This is causing a downstream build issue in aya.

Reproduction:

$ cargo init --lib
    Creating library package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cargo +nightly build --target=bpfel-unknown-none -Z build-std=core --release
   Compiling core v0.0.0 (/home/intr/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.157
   Compiling rustc-std-workspace-core v1.99.0 (/home/intr/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error[E0432]: unresolved import `core::sync::atomic::AtomicU32`
 --> /home/intr/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/compiler_builtins-0.1.157/src/math/libm_math/support/feature_detect.rs:3:26
  |
3 | use core::sync::atomic::{AtomicU32, Ordering};
  |                          ^^^^^^^^^
  |                          |
  |                          no `AtomicU32` in `sync::atomic`
  |                          help: a similar name exists in the module: `AtomicU64`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `compiler_builtins` (lib) due to 1 previous error

Downstream issue

This can be seen in a real-life example by following the instructions here for setting up an aya template repository, which will fail to build with the same error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions