Skip to content

document environment variables used when building the compiler #436

Closed
@vitiral

Description

@vitiral

I am a newbie to compiler development and came across a pretty big documentation gap: environment variables.

I ran the following script to try and pull out all the existing environment variables. I can run it on whatever directories that project contributors want me to. I would like to document these if possible!

Action items for someone more knowledgeable than me:

  • I am running against src/lib* src/bootstrap. Are there other directories I should be searching?
  • I am searching for env::var(_os) (rust) and os.environ.get (python). Are there other regexes that should be searched?
  • Please provide feedback on which of these should be better documented, and if you have a one line "off the top of my head" documentation feel free to write it here.
  • Does stage0 complicate things, and we need to be mindful of what environment variables are set when compiling the compiler?
  • I think these should probably go in the Configuration section. Let me know if you have a better spot in mind.
rg '^.*?((env::var(_os)?)|(os\.environ\.get))\(([\w"]+)\).*?$' \
    -r '$5' -N --no-filename \
    src/lib* src/bootstrap \
    | sort -u
Output
"APPVEYOR"                                                                                                                                                                                                 
"AR"                    
"BOOTSTRAP_PARENT_ID"
"BOOTSTRAP_PYTHON"     
"BUILD"                                
"CARGO_CFG_TARGET_ARCH"
"CARGO_CFG_TARGET_ENV"
"CARGO_CFG_TARGET_OS"
"CARGO_CFG_TARGET_VENDOR"
"CARGO_TARGET_DIR"     
"CFG_COMPILER_HOST_TRIPLE"
"CFLAGS"            
"DESTDIR"                       
"HOME"                        
"HOST"               
"JEMALLOC_OVERRIDE"
key            
"L4RE_LIBDIR"        
libdir         
"LLVM_CONFIG"  
"LLVM_LINK_SHARED"
"LLVM_RUSTLLVM"        
"LLVM_STATIC_STDCPP"   
"MACOSX_DEPLOYMENT_TARGET"
"MACOSX_STD_DEPLOYMENT_TARGET"
"MAKEFLAGS"     
"MSYSCON"          
"MUSL_ROOT"             
"NUM_JOBS"                 
"OUT_DIR"              
"PAGER"                                
"PATH"                
"RUST_BACKTRACE"   
rustc              
"RUSTC_BOOTSTRAP"
"RUSTC_CODEGEN_UNITS"  
"RUSTC_COLOR"            
"RUSTC_CRT_STATIC"
"RUSTC_DEBUG_ASSERTIONS"        
"RUSTC_DEBUGINFO"
"RUSTC_DEBUGINFO_LINES"
"RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER"
"RUSTC_FORCE_UNSTABLE"
"RUSTC_HOST_LINKER"  
"RUSTC_INCREMENTAL"
"RUSTC_LIBDIR" 
"RUSTC_METADATA_SUFFIX"
"RUSTC_NO_PREFER_DYNAMIC"
"RUSTC_ON_FAIL"        
"RUSTC_RETRY_LINKER_ON_SEGFAULT"
"RUSTC_RPATH"
"RUSTC_SAVE_ANALYSIS"
"RUSTC_STAGE"
"RUSTC_SYSROOT"
"RUSTC_TARGET_LINKER"
"RUSTC_THINLTO"
"RUSTC_VERBOSE"
"RUST_DEP_GRAPH"
"RUST_DEP_GRAPH_FILTER"
"RUSTDOC_CRATE_VERSION"
"RUSTDOC_REAL"   
"RUST_FORBID_DEP_GRAPH_EDGE"
"RUST_MIN_STACK"
"RUST_REGION_GRAPH"
"RUST_REGION_GRAPH_NODE"
"RUST_SAVE_ANALYSIS_CONFIG"
"RUST_TARGET_PATH"     
"RUST_TEST_NOCAPTURE"                  
"RUST_TEST_STRESS"    
"RUST_TEST_THREADS"
"SCCACHE_ERROR_LOG"
"SCCACHE_PATH"
"SCCACHE_TARGET"       
"SRC"                    
"SUDO_USER"    
"TARGET"                        
"TERM"       
"TERMINFO"           
"TERMINFO_DIRS"
"TEST_DEVICE_ADDR"
"TEST_MIRI"          
"TMPDIR"       
"TRAVIS"       
"USER"          
"USERPROFILE"          
var                    
"WIX"       

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions