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

Cannot compile std with atomics feature on wasm32-unknown-unknown target #86802

Closed
tversteeg opened this issue Jul 2, 2021 · 0 comments · Fixed by #86807
Closed

Cannot compile std with atomics feature on wasm32-unknown-unknown target #86802

tversteeg opened this issue Jul 2, 2021 · 0 comments · Fixed by #86807
Labels
C-bug Category: This is a bug.

Comments

@tversteeg
Copy link
Contributor

I tried compiling an empty library, created with cargo init --lib, with the following flags:

RUSTFLAGS='-C target-feature=+atomics' cargo +nightly build --target wasm32-unknown-unknown -Z build-std=std
Cargo.toml
[package]
name = "wasm-test"
version = "0.1.0"
edition = "2018"

[lib]
crate-type = ["cdylib"]

[dependencies]

I expected it to compile properly. Instead, I got the following error:

error[E0252]: the name `unsupported` is defined multiple times
 --> /home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/wasm/atomics/thread.rs:5:5
  |
1 | use super::unsupported;
  |     ------------------ previous import of the value `unsupported` here
...
5 | use crate::sys::unsupported;
  |     ^^^^^^^^^^^^^^^^^^^^^^^ `unsupported` reimported here
  |
  = note: `unsupported` must be defined only once in the value namespace of this module
Full output
   Compiling compiler_builtins v0.1.46
   Compiling core v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.93
   Compiling cc v1.0.68
   Compiling dlmalloc v0.2.1
   Compiling std v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling unwind v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.18
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
   Compiling gimli v0.23.0
   Compiling std_detect v0.1.5 (/home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling miniz_oxide v0.4.0
   Compiling hashbrown v0.11.0
   Compiling object v0.22.0
   Compiling addr2line v0.14.0
error[E0252]: the name `unsupported` is defined multiple times
 --> /home/thomas/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/wasm/atomics/thread.rs:5:5
  |
1 | use super::unsupported;
  |     ------------------ previous import of the value `unsupported` here
...
5 | use crate::sys::unsupported;
  |     ^^^^^^^^^^^^^^^^^^^^^^^ `unsupported` reimported here
  |
  = note: `unsupported` must be defined only once in the value namespace of this module

error: aborting due to previous error

For more information about this error, try `rustc --explain E0252`.
error: could not compile `std`

To learn more, run the command again with --verbose.

Meta

rustc +nightly --version --verbose:

rustc 1.55.0-nightly (7100b311d 2021-07-01)
binary: rustc
commit-hash: 7100b311df0367c4d9067687573d1396b22411df
commit-date: 2021-07-01
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1
@tversteeg tversteeg added the C-bug Category: This is a bug. label Jul 2, 2021
@bors bors closed this as completed in df55204 Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant