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-std compilation fails depending on custom target's file name when compiling wasm32 with target-feature atomics #13035

Closed
Kyykek opened this issue Nov 22, 2023 · 2 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@Kyykek
Copy link

Kyykek commented Nov 22, 2023

Problem

Cargo fails to compile custom target with build-std (std, panic_abort) depending on the file name of the json target spec (see steps below). Source code.
The target.json files used for this were copies of the wasm32-unknown-unknown target spec with added "features": "+atomics,+bulk-memory". The problem also persists when using rustflags.

Steps

(All steps are with build-std in the config.toml file and target-feature being set one way or another)

compare target files

diff target.json wasm32-target.json
<no output>

wasm-target.json

cargo +nightly build --target=wasm32-target.json
Finished dev [unoptimized + debuginfo] target(s) in 0.05s

target.json

cargo +nightly build --target=target.json
error: `futex_condvar::Condvar::new` is not yet stable as a const fn
   --> [HOME_DIR]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/condvar.rs:127:26
    |
127 |         Condvar { inner: sys::Condvar::new() }
    |                          ^^^^^^^^^^^^^^^^^^^

error: `futex_mutex::Mutex::new` is not yet stable as a const fn
   --> [HOME_DIR]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/mutex.rs:230:24
    |
230 |         Mutex { inner: sys::Mutex::new(), poison: poison::Flag::new(), data: UnsafeCell::new(t) }
    |                        ^^^^^^^^^^^^^^^^^

error: `sys_common::once::futex::Once::new` is not yet stable as a const fn
  --> [HOME_DIR]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/once.rs:76:23
   |
76 |         Once { inner: sys::Once::new() }
   |                       ^^^^^^^^^^^^^^^^

error: `futex_rwlock::RwLock::new` is not yet stable as a const fn
   --> [HOME_DIR]/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sync/rwlock.rs:161:25
    |
161 |         RwLock { inner: sys::RwLock::new(), poison: poison::Flag::new(), data: UnsafeCell::new(t) }
    |                         ^^^^^^^^^^^^^^^^^^

Possible Solution(s)

No response

Notes

Tested with a few nightly versions of the last week.

Version

cargo 1.76.0-nightly (71cd3a926 2023-11-20)
release: 1.76.0-nightly
commit-hash: 71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6
commit-date: 2023-11-20
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.4.0-DEV (sys:0.4.68+curl-8.4.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Debian 12 (bookworm) [64-bit]
@Kyykek Kyykek added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Nov 22, 2023
@ehuss
Copy link
Contributor

ehuss commented Nov 22, 2023

Thanks for the report! This is a known issue tracked in rust-lang/rust#104761. You'll need to mirror a related target name for now.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2023
@Kyykek
Copy link
Author

Kyykek commented Nov 22, 2023

Thanks for the report! This is a known issue tracked in rust-lang/rust#104761. You'll need to mirror a related target name for now.

Thank you very much! I expected this to be the case but couldn't find it anywhere :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants