-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
-Zbuild-stdUnstable Cargo option: Compile the standard library yourself.Unstable Cargo option: Compile the standard library yourself.A-panicArea: Panicking machineryArea: Panicking machineryC-bugCategory: This is a bug.Category: This is a bug.
Description
I have tried this on ubuntu and alpine docker containers.
Steps:
-
Install dependencies
ubuntu:apt update && apt install curl clang
alpine:apk add curl clang musl-dev
-
Try to build project:
curl --proto '=https' --tlsv1.3 -sSf https://sh.rustup.rs | sh
export PATH="$HOME/.cargo/bin:$PATH"
rustup override set nightly
rustup component add rust-src
cargo new test_build_std --vcs none
cd test_build_std
echo '[profile.release]' >> Cargo.toml
echo 'panic = "abort"' >> Cargo.toml
cargo build --release -Zbuild-std
I expected to see this happen: project successfully compiles
Instead, this happened: build failed with the following error
Alpine:
error[E0152]: duplicate lang item in crate `core`: `sized`
|
= note: the lang item is first defined in crate `core` (which `std` depends on)
= note: first definition in `core` loaded from /test_build_std/target/x86_64-unknown-linux-musl/release/deps/libcore-ea86b8bdb00db001.rlib, /test_build_std/target/x86_64-unknown-linux-musl/release/deps/libcore-ea86b8bdb00db001.rmeta
= note: second definition in `core` loaded from /root/.rustup/toolchains/nightly-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-8c023576fd012662.rlib
For more information about this error, try `rustc --explain E0152`.
error: could not compile `test_build_std` (bin "test_build_std") due to 1 previous error
Ubuntu:
error[E0152]: duplicate lang item in crate `core`: `sized`
|
= note: the lang item is first defined in crate `core` (which `std` depends on)
= note: first definition in `core` loaded from /test_build_std/target/release/deps/libcore-521f42810889a0fe.rlib, /test_build_std/target/release/deps/libcore-521f42810889a0fe.rmeta
= note: second definition in `core` loaded from /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-62c8dfa7db58d93c.rlib
For more information about this error, try `rustc --explain E0152`.
error: could not compile `test_build_std` (bin "test_build_std") due to 1 previous error
Meta
rustc --version --verbose
:
rustc 1.90.0-nightly (4b55fe199 2025-08-01)
binary: rustc
commit-hash: 4b55fe199cfe9c710555a5af7f2a49491ad38254
commit-date: 2025-08-01
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8
rustc 1.90.0-nightly (4b55fe199 2025-08-01)
binary: rustc
commit-hash: 4b55fe199cfe9c710555a5af7f2a49491ad38254
commit-date: 2025-08-01
host: x86_64-unknown-linux-musl
release: 1.90.0-nightly
LLVM version: 20.1.8
As I understand, the main problem is panic="abort"
, if I don't use that, build finishes successfully.
Metadata
Metadata
Assignees
Labels
-Zbuild-stdUnstable Cargo option: Compile the standard library yourself.Unstable Cargo option: Compile the standard library yourself.A-panicArea: Panicking machineryArea: Panicking machineryC-bugCategory: This is a bug.Category: This is a bug.