nixpkgs-mozilla icon indicating copy to clipboard operation
nixpkgs-mozilla copied to clipboard

`cargo doc` doesn't work for `thumbv7m-none-eabi` targets

Open mayl opened this issue 4 years ago • 0 comments

Hi, I've been trying to set up a nix-shell for doing embedded Rust development for ARM. The shell I have so far can compile working binaries, which is great! Unfortunately, I can't get cargo doc to work.

The shell.nix I'm using is:

let
  moz_overlay = import (bulitins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
  nixpkgs = import <nixpkgs>{ overlays = [moz_overlay]; };
in
  with nixpkgs;

  stdenv.mkDerivation {
    name = "rust-env";
    buildINputs = [
        (nixpkgs.rustChannelOfTargets "stable" null [ "thumbv7m-none-eabi" ])
        gcc-arm-embedded #for binutils, etc
    ];
  }

And the error I am getting from cargo doc is:

error[E0463]: can't find crate for `core`
  |
  = note: the `thumbv7m-none-eabi` target may not be installed

I've found that .cargo/config allows the documentation to be built (but obviously compiling binaries doesn't work without the target specified). Also, building the project with a toolchain installed on Ubuntu with rustup successfully builds the documentation. I get the same behavior where rustup toolchains work, but nix-shell doesn't across several thumbv7m-none-eabi projects I've cloned off github.

I've searched quite a bit for other examples of this issue, but am coming up empty. The fact that it works properly with a rustup installed toolchain in a more "standard" environment, and the error asks for a toolchain that is installed (it compiles binaries!) suggests that it may be a packaging issue? Does the overlay have to add a path somewhere for rustdoc to find core for non-native builds?

I'm obviously very new at both Nix and Rust, so any help is much appreciated!

mayl avatar May 27 '20 13:05 mayl