Rustup: Missing src directory on nightly install?

Created on 21 Dec 2016  路  3Comments  路  Source: rust-lang/rustup

So I've been doing some digging on a problem I've run into when going through an operating system tutorial book called IntermezzOS.
At first I thought this could be my code but it also exists with Intermezzos's kernel

I'm on a Macbook Air 2013, running the latest OSX, using zsh, make, and the latest rust nightly.

$ uname -ar
Darwin Davids-Air.home 16.1.0 Darwin Kernel Version 16.1.0: Wed Oct 19 20:31:56 PDT 2016; root:xnu-3789.21.4~4/RELEASE_X86_64 x86_64

The problem

I'm using xargo to compile for the x86_64 architecture, but it doesn't find the files it's looking for from my rustup nightly installation.

$ make cargo
$ xargo build --release --target x86_64-unknown-intermezzos-gnu
error: error recursively walking the sysroot
caused by: IO error for operation on /Users/david/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src: No such file or directory (os error 2)
caused by: No such file or directory (os error 2)
stack backtrace:
   0:        0x10c96a97e - backtrace::backtrace::trace::h855657dbc57f873e
   1:        0x10c96ac8c - backtrace::capture::Backtrace::new::h023332005d95d7ee
   2:        0x10c961f14 - error_chain::make_backtrace::h108eeef8309125ae
   3:        0x10c957b6d - xargo::sysroot::update::he9d9db555251a0bc
   4:        0x10c95efaf - xargo::run::h23a7a3aad2bd5113
   5:        0x10c95c09f - xargo::main::h3336704a938bcf84
   6:        0x10c99b25a - __rust_maybe_catch_panic
   7:        0x10c99a806 - std::rt::lang_start::hefd96b70277e8a4a
make: *** [cargo] Error 1

digging into it

I'm sure I'm running the current version of rustc.

~/.rustup/toolchains/nightly-x86_64-apple-darwin $ ./bin/rustc --version
rustc 1.15.0-nightly (71c06a56a 2016-12-18)
# from another shell on my machine
$which rustup
/Users/david/.cargo/bin/rustup
 ~/.rustup/toolchains/nightly-x86_64-apple-darwin $ rustc --version
rustc 1.15.0-nightly (71c06a56a 2016-12-18)

Looking for the src folder mentioned in the output; it looks indeed like it was never created by rustup.

Is /Users/david/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src meant to be for a generic architecture? I ask that because running rustup target add aarch64-unknown-linux-gnu added the aarch64-unknown-linux-gnu folder inside of rustlib.

 ~/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib $ ls -la 
total 184K
drwxr-xr-x 3 david staff  102 Dec 21 16:02 aarch64-unknown-linux-gnu
-rw-r--r-- 1 david staff  116 Dec 21 16:02 components
drwxr-xr-x 6 david staff  204 Dec 19 22:41 etc
-rw-r--r-- 1 david staff 1.1K Dec 19 22:41 manifest-cargo-x86_64-apple-darwin
-rw-r--r-- 1 david staff 4.8K Dec 21 16:02 manifest-rust-std-aarch64-unknown-linux-gnu
-rw-r--r-- 1 david staff 4.5K Dec 19 22:41 manifest-rust-std-x86_64-apple-darwin
-rw-r--r-- 1 david staff 2.2K Dec 19 22:41 manifest-rustc-x86_64-apple-darwin
-rw-r--r-- 1 david staff 145K Dec 21 16:02 multirust-channel-manifest.toml
-rw-r--r-- 1 david staff  277 Dec 21 16:02 multirust-config.toml
-rw-r--r-- 1 david staff    1 Dec 21 16:02 rust-installer-version
drwxr-xr-x 3 david staff  102 Dec 19 22:41 x86_64-apple-darwin

Either way I'm not exactly sure what's going on with rustup or whether it's something wrong with my machine / rust install or not.

How to recreate the issue:

Run these commands on the latest OSX and please let me know if there's anything else I can do to help figure out this issue.

$ git clone https://github.com/intermezzOS/kernel intermezzos
$ cd intermezzos
$ cargo install
$ make cargo

Thank you in advance for any and all help and feedback.

Most helpful comment

The problem is you don't have your rust sources installed. I think rustup used to install them by default, but now you have to add them as an optional component.

rustup component add rust-src should add the rust sources where xargo expects them, allowing compilation to proceed as usual.

All 3 comments

Hey David! intermezzOS maintainer here. I haven't had much time for it in the past two months, so I haven't compiled it myself in a while. Just wanted to let you know that if you find any other bugs, they also might be changes in Rust that weren't applied to the kernel yet. I'm not aware of any; it _should_ just build.

The problem is you don't have your rust sources installed. I think rustup used to install them by default, but now you have to add them as an optional component.

rustup component add rust-src should add the rust sources where xargo expects them, allowing compilation to proceed as usual.

Sources have always been an optional component, you may be thinking of docs?

Was this page helpful?
0 / 5 - 0 ratings