Giter Site home page Giter Site logo

Comments (10)

petrochenkov avatar petrochenkov commented on May 26, 2024 2

Most of the listed variables are used by the build system and test suite, not compiler itself.
Many of them are also implementation details (they are both set and read internally) that are not supposed to be set from the outside of rustbuild.

(P.S. I suspect the meaning of many of internal variables could could be more clear if naming schemes were more explicit and consistent, e.g. everything used by bootstrap/bin/rustc.rs could be prefixed with RUSTC_WRAPPER_, bootstrap/bin/rustdoc.rs - RUSTDOC_WRAPPER_, etc.)

from rustc-dev-guide.

pnkfelix avatar pnkfelix commented on May 26, 2024 1

There was some semi-recent discussion bemoaning the compilers undiscoverable environment variables; I suggested there that it might be a good idea to extend the rustc --help -v output to include a section dedicated to environment variables.

from rustc-dev-guide.

vitiral avatar vitiral commented on May 26, 2024

Note: I believe this is dfferent from rust-lang/rust#44074, as this is concerned with the environment variables used for building the compiler itself, not the environment variables that the compiler uses.

However, stage0 probably makes use of the latter. I'm not sure how to manage the fact that those are related -- we probably need to document both.

rust-lang/rust#44074 also brings up the env! macro. Please let me know if there are other ways to get environment variables than env::var(_os) (rust) and os.environ.get (python). Hopefully we don't have too many bash scripts, as it would just look like plain old variables there...

from rustc-dev-guide.

theotherjimmy avatar theotherjimmy commented on May 26, 2024

the rustc and libdir variables appear to be "RUSTC_STAGE", "RUSTC_REAL", "RUSTC_SNAPSHOT_LIBDIR", "RUSTC_LIBDIR"

    let (rustc, libdir) = if target.is_none() && version.is_none() {
        ("RUSTC_SNAPSHOT", "RUSTC_SNAPSHOT_LIBDIR")
    } else {
        ("RUSTC_REAL", "RUSTC_LIBDIR")
    };
    let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
    let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set");
    let mut on_fail = env::var_os("RUSTC_ON_FAIL").map(|of| Command::new(of));

    let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
    let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
    let mut dylib_path = bootstrap::util::dylib_path();
    dylib_path.insert(0, PathBuf::from(libdir));

    let mut cmd = Command::new(rustc);
    cmd.args(&args)

from rustc-dev-guide.

retep998 avatar retep998 commented on May 26, 2024

Also be wary of code that does use std::env::var; and uses it simply as var.

from rustc-dev-guide.

steveklabnik avatar steveklabnik commented on May 26, 2024

Triage: we now have a home for this kind of information https://doc.rust-lang.org/rustc/

from rustc-dev-guide.

pnkfelix avatar pnkfelix commented on May 26, 2024

(But in practice if we want such a list to be kept up to date, we'll need an API for defining the environment variables in active use by the compiler, much the same way that we define e.g. command line switches via a standard API...)

from rustc-dev-guide.

mark-i-m avatar mark-i-m commented on May 26, 2024

Has there been any progress on this?

from rustc-dev-guide.

mark-i-m avatar mark-i-m commented on May 26, 2024

Fyi

https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/env.20vars.20and.20x.2Epy.20.2338686

from rustc-dev-guide.

jyn514 avatar jyn514 commented on May 26, 2024

Most of the listed variables are used by the build system and test suite, not compiler itself.
Many of them are also implementation details (they are both set and read internally) that are not supposed to be set from the outside of rustbuild.

I agree with this. Given that we document how to replicate the environment variables for a given run (https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html#environment-variables) I don't think it's important to document the variables themselves - the supported interface here is config.toml, not the env vars. If we were going to document this it would live in src/bootstrap/README.md anyway, not the external facing docs.

from rustc-dev-guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.