rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.59k stars 2.39k forks source link

duplicate lang item issue with no_std build #7951

Closed brenzi closed 4 years ago

brenzi commented 4 years ago

Problem When building https://github.com/encointer/encointer-worker/commit/7252e20264e63c7dce11470922d7c2965378842e

I get an error:

error: duplicate lang item in crate `sgx_tstd` (which `palette_support` depends on): `f32_runtime`.
  |
  = note: first defined in crate `std` (which `pallet_encointer_ceremonies` depends on).

error: duplicate lang item in crate `sgx_tstd` (which `palette_support` depends on): `f64_runtime`.
  |
  = note: first defined in crate `std` (which `pallet_encointer_ceremonies` depends on).

error: duplicate lang item in crate `sgx_tstd` (which `palette_support` depends on): `panic_impl`.
  |
  = note: first defined in crate `std` (which `pallet_encointer_ceremonies` depends on).

error: duplicate lang item in crate `sgx_tstd` (which `palette_support` depends on): `begin_panic`.
  |
  = note: first defined in crate `std` (which `pallet_encointer_ceremonies` depends on).

error: duplicate lang item in crate `sgx_tstd` (which `palette_support` depends on): `oom`.
  |
  = note: first defined in crate `std` (which `pallet_encointer_ceremonies` depends on).

error: aborting due to 5 previous errors

The strange thing is that it is caused by the last commit, introducing the dependency on https://github.com/encointer/pallet-encointer-ceremonies but that crate has no dependencies (and no new features) that were not present in the previous commit.

Steps (you may need to install Intel SGX SDK first) or binary install

git clone https://github.com/encointer/encointer-worker
cd encointer worker
git checkout 7252e20264e63c7dce11470922d7c2965378842e
cd enclave
make

You should see the error above

Whereas the following should work

git checkout 5220a7560dde3cdd893aa913c73c561e0969e5f3
make

Notes cargo 1.41.0-nightly (8280633db 2019-11-11)

cargo nono check: cargo nono check warns about exactly the same crates in both commits

webpki: FAILURE
log: FAILURE
serde_json: FAILURE
sgx-externalities: FAILURE
env_logger: FAILURE
rustls: FAILURE
num-bigint: FAILURE
webpki-roots: FAILURE
substratee-stf: FAILURE
chrono: FAILURE
base64: FAILURE
yasna: FAILURE
serde: FAILURE
bit-vec: FAILURE
rust-base58: FAILURE

whereas none of them are dependencies of pallet-encointer-ceremonies.

However, serde is a dev-dependency, but I've already checked if I'm running into #5730 or one of the similar issues. I just removed all dev-dependencies in pallet-encointer-ceremonies. To no success

brenzi commented 4 years ago

This is a stupid bug on my side. I forgot to put #![no_std] in the new crate.

brenzi commented 4 years ago

This is a stupid bug on my side. I forgot to put #![no_std] in the new crate.