Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

New cortex-m-rt rand dependency breaks builds #105

Closed
therealprof opened this issue Sep 6, 2018 · 9 comments
Closed

New cortex-m-rt rand dependency breaks builds #105

therealprof opened this issue Sep 6, 2018 · 9 comments

Comments

@therealprof
Copy link
Contributor

I was just trying to port the microbit crate to cortex-m-rt 0.6.0 but I'm facing this here:

   Compiling rand_core v0.2.1
   Compiling cortex-m-rt v0.6.0
error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv6m-none-eabi` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `rand_core`.
warning: build failed, waiting for other jobs to finish...
error: build failed

@japaric Seems something is messing (or not) with the required flags for no_std.

@japaric
Copy link
Member

japaric commented Sep 6, 2018

sigh this is probably that Cargo limitation where it keeps a single dependency graph for both build-dependencies (compiled for the host) and other dependencies (compiled for the target). Making rand not depend on std may fix this.

@japaric
Copy link
Member

japaric commented Sep 6, 2018

Making rand not depend on std may fix this.

I meant: make our rand build dependency not depend on std may fix this.

@therealprof
Copy link
Contributor Author

That works. NB: It's fairly annoying to test that... requires all local checkouts and changing everything to paths because (of course) cortex-m-rt is first imported by the peripheral access API crates...

Oh, and I run into another funkiness which prevents me from compiling cortex-m-rt examples from the checkout:

   Compiling volatile-register v0.2.0
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
 --> macros/src/lib.rs:4:1
  |
4 | extern crate rand;
  | ^^^^^^^^^^^^^^^^^^
  |
  = help: add #![feature(rustc_private)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
...

therealprof added a commit to therealprof/cortex-m-rt that referenced this issue Sep 6, 2018
Due to the single dependency tree, the attempted use of a std version
flips all depending crates to the std version as well which will not
compile on no_std systems.

Fixes rust-embedded#105

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
@adamgreig
Copy link
Member

I don't get this error when using the new 0.6.0 on a thumbv7em-none-eabi target. Everything builds fine.

@japaric
Copy link
Member

japaric commented Sep 6, 2018

@adamgreig this only happens if your crate depend on the rand crate.

@adamgreig
Copy link
Member

Right, I'd just realised but you beat me to pointing it out. Makes sense.

@therealprof
Copy link
Contributor Author

Ah, and I get your point now. Will do. ;)

therealprof added a commit to therealprof/cortex-m-rt that referenced this issue Sep 6, 2018
Due to the single dependency tree, the attempted use of a std version
flips all depending crates to the std version as well which will not
compile on no_std systems.

Fixes rust-embedded#105

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
@therealprof
Copy link
Contributor Author

Can we move this forward?

therealprof added a commit to therealprof/cortex-m-rt that referenced this issue Sep 7, 2018
Due to the single dependency tree, the attempted use of a std version
flips all depending crates to the std version as well which will not
compile on no_std systems.

Fixes rust-embedded#105

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
@little-arhat
Copy link

What is the plan for this? Will merging therealprof@bddf23b suffice or is there more to it?

bors bot added a commit that referenced this issue Sep 8, 2018
107: Disable default-features on rand dependency to avoid std version r=japaric a=therealprof

Due to the single dependency tree, the attempted use of a std version
flips all depending crates to the std version as well which will not
compile on no_std systems.

Fixes #105

Signed-off-by: Daniel Egger <daniel@eggers-club.de>

Co-authored-by: Daniel Egger <daniel@eggers-club.de>
@bors bors bot closed this as completed in #107 Sep 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants