From a130153f4113303b24e0104da1c3c670801703b8 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Tue, 12 Nov 2019 11:08:55 -0600 Subject: [PATCH 1/2] document rustc internal env vars --- src/building/bootstrapping.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/building/bootstrapping.md b/src/building/bootstrapping.md index 126509077..83f9a867c 100644 --- a/src/building/bootstrapping.md +++ b/src/building/bootstrapping.md @@ -159,3 +159,16 @@ links against. This `stage2/bin/rustc` compiler is shipped to end-users, along with the `stage 1 {std,rustc}` artifacts. +## Environment Variables + +During bootstrapping, there are a bunch of compiler-internal environment +variables that are used. If you are trying to run an intermediate version of +`rustc`, sometimes you may need to set some of these environment variables +manually. Otherwise, you get an error like the following: + +```text +thread 'main' panicked at 'RUSTC_STAGE was not set: NotPresent', src/libcore/result.rs:1165:5 +``` + +To find out the values of the variables, you can add the following flag to your +`x.py` command: `--on-fail=print-env`. From 165eff2ec0ae63377af92a0c32d1ee23dd1f12b2 Mon Sep 17 00:00:00 2001 From: Mark Mansi Date: Fri, 6 Dec 2019 10:38:37 -0600 Subject: [PATCH 2/2] add note from Mark-Simulacrum --- src/building/bootstrapping.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/building/bootstrapping.md b/src/building/bootstrapping.md index 83f9a867c..5bdc8dc6f 100644 --- a/src/building/bootstrapping.md +++ b/src/building/bootstrapping.md @@ -170,5 +170,9 @@ manually. Otherwise, you get an error like the following: thread 'main' panicked at 'RUSTC_STAGE was not set: NotPresent', src/libcore/result.rs:1165:5 ``` -To find out the values of the variables, you can add the following flag to your -`x.py` command: `--on-fail=print-env`. +If `./stageN/bin/rustc` gives an error about environment variables, that +usually means something is quite wrong -- or you're trying to compile e.g. +`librustc` or `libstd` or something that depends on environment variables. In +the unlikely case that you actually need to invoke rustc in such a situation, +you can find the environment variable values by adding the following flag to +your `x.py` command: `--on-fail=print-env`.