Skip to content

Error when building with panic = "abort" and -Z build-std #80685

@dalcde

Description

@dalcde

EDIT: The same happens with building an (empty) binary crate with panic = "abort" and -Z build-std, without cross-compilation

Create an empty library crate with crate-type = ["cdylib"]. Then attempt to build with

cargo +nightly build -Z build-std --target wasm32-unknown-unknown

Then you get lots of errors of the form

error: duplicate lang item in crate `core`: `RangeToInclusive`.
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /tmp/foobar/target/wasm32-unknown-unknown/debug/deps/libcore-7e733f1b75b6332e.rlib, /tmp/foobar/target/wasm32-unknown-unknown/debug/deps/libcore-7e733f1b75b6332e.rmeta
  = note: second definition in `core` loaded from /home/$USER/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/wasm32-unknown-unknown/lib/libcore-73412d1456c20040.rlib

This works if either cdylib, build-std or cross-compiling to wasm32-unknown-unknown is removed. I have not attempted to cross-compile to other architectures.

Meta

This is using rustc 1.51.0-nightly (80184183b 2021-01-03)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions