Skip to content

[-Zbuild-std] Duplicate lang item with panic=abort #15058

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

Closed
hoodmane opened this issue Jan 13, 2025 · 4 comments
Closed

[-Zbuild-std] Duplicate lang item with panic=abort #15058

hoodmane opened this issue Jan 13, 2025 · 4 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@hoodmane
Copy link

hoodmane commented Jan 13, 2025

Problem

panic=abort doesn't work with -Zbuild-std.
xref related issues:
rust-lang/wg-cargo-std-aware#29
#7359

This is probably the same issue as #7359. I am opening this as well because the reproduction is simpler. I get the same error when I try to use https://github.com/RalfJung/rustc-build-sysroot to build my own sysroot.

Steps

Presumably this problem has been around for a while but for definiteness I picked today's nightly.

Make a folder with the following two files:

Cargo.toml

[package]
name = "test"
edition = "2024"

[profile.dev]
panic = "abort"

[[bin]]
name = "test"
path = "main.rs"

main.rs

pub fn main() { }

Bash

  1. rustup install nightly-2025-01-13
  2. cargo build -Zbuild-std

Result

   Compiling tmp v0.0.0 (/home/rchatham/Documents/programming/rust-wasm-eh-test-2)
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 /home/rchatham/Documents/programming/rust-wasm-eh-test-2/target/wasm32-unknown-emscripten/debug/deps/libcore-05cdacbb5559ef58.rlib, /home/rchatham/Documents/programming/rust-wasm-eh-test-2/target/wasm32-unknown-emscripten/debug/deps/libcore-05cdacbb5559ef58.rmeta
  = note: second definition in `core` loaded from /home/rchatham/.rustup/toolchains/nightly-2025-01-13-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-emscripten/lib/libcore-9c3bca22b80bc54a.rlib

For more information about this error, try `rustc --explain E0152`.
error: could not compile `test` (bin "test") due to 1 previous error

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.86.0-nightly (088d49608 2025-01-10)
release: 1.86.0-nightly
commit-hash: 088d496082726091024f1689c124a0c3dccbd775
commit-date: 2025-01-10
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 22.4.0 (jammy) [64-bit]
@hoodmane hoodmane added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jan 13, 2025
@weihanglo
Copy link
Member

Thanks for the reproduction! I've updated the issue description to include your MRE. Close in favor of #7359.

@hoodmane
Copy link
Author

@weihanglo would you mind also renaming #7359 to the title of my issue? The title of #7359 includes the phrase "no-harness test" which is I think irrelevant to the bug.

@weihanglo
Copy link
Member

Updated. Thanks!

@hoodmane
Copy link
Author

Thanks @weihanglo!

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