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

Fix std compilation error for wasi+atomics #110587

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Apr 20, 2023

Fix #109727

It seems that the unsupported/once.rs module isn't meant to exist at the same time as the futex module, as they have conflicting definitions.

I've solved this by defining the once module only if not(target_feature = "atomics").
The wasm32-unknown-unknown target similarly only defines the once module if not(target_feature = "atomics").

As show in this block of code, the sys::once module doesn't need to exist if all(target_arch = "wasm32", target_feature = "atomics").

@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2023

r? @joshtriplett

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 20, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@tomaka
Copy link
Contributor Author

tomaka commented Apr 20, 2023

As a heads up, I'll probably open another PR afterwards to make wasm32-wasi work properly with atomics on. I'm still trying to figure out how to try out my locally-built std.

@jyn514
Copy link
Member

jyn514 commented Apr 20, 2023

@tomaka right now you need to also build the compiler to use a local std in a dev toolchain, see #101691. you can run x build std --stage 1 and that should work (follow the instructions in https://rustc-dev-guide.rust-lang.org/building/suggested.html#configuring-rustup-to-use-nightly). you can also set download-rustc = true to avoid having to build the whole compiler and that should work if you pass --stage 2 instead of 1.

@tomaka
Copy link
Contributor Author

tomaka commented Apr 20, 2023

I'll probably open another PR afterwards to make wasm32-wasi work properly with atomics on

Or maybe not.
Thread-safe wasi seems to be a ton of history, and it's a bit too overwhelming for me to figure out what the situation is.
Since there seems to be some movement, I'll just wait.

Nonetheless, this small PR is still worth merging, since it moves the situation from "doesn't compile" to "compiles".

@jyn514
Copy link
Member

jyn514 commented Apr 26, 2023

How can I test this change? RUSTFLAGS_BOOTSTRAP="-C target-features=+atomics,+bulk-memory" x build std --target=wasm32-wasi tells me I'm missing a wasi-root key:

thread 'main' panicked at 'Target "wasm32-wasi" does not have a "wasi-root" key', compile.rs:276:17

@jyn514
Copy link
Member

jyn514 commented Apr 26, 2023

ah, using check instead worked:

; RUSTFLAGS_BOOTSTRAP="-C target-feature=+atomics,+bulk-memory" x check std --target=wasm32-wasi

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 26, 2023

📌 Commit 01c4f31 has been approved by jyn514

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 26, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 26, 2023
Rollup of 9 pull requests

Successful merges:

 - rust-lang#108416 (black_box doc corrections for clarification - Issue rust-lang#107957)
 - rust-lang#109379 (Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs`)
 - rust-lang#110266 (Update documentation wording on path 'try_exists' functions)
 - rust-lang#110329 (Improve tests for rust-lang#110138)
 - rust-lang#110418 (Spelling rustdoc)
 - rust-lang#110587 (Fix `std` compilation error for wasi+atomics)
 - rust-lang#110594 (`rustc --help` add `--cfg` SPEC declaration.)
 - rust-lang#110792 (Use the standard macOS CI runner)
 - rust-lang#110817 (Add regression tests for const-generic inherent associated types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3fbaf78 into rust-lang:master Apr 26, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 26, 2023
@tomaka tomaka deleted the fix-109727 branch April 26, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std compilation error when compiling for wasm32-wasi with -C target-feature=+atomics,+bulk-memory
5 participants