Don't let runtime env variables of compiler like deps leak into the build environment#40916
Conversation
Adds `drop` to EnvironmentModifications courtesy of @haampie, and uses it to clear modifications of CC, CXX, F77 and FC made by `setup_{,dependent_}run_environment` routines when producing an environment in BUILD context.
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
tgamblin
left a comment
There was a problem hiding this comment.
LGTM -- minor request and we're good
| pkg.setup_dependent_run_environment(run_env_mods, spec) | ||
| pkg.setup_run_environment(run_env_mods) | ||
| if self.context == Context.BUILD: | ||
| # Don't let the runtime environment of comiler like dependencies leak into the |
There was a problem hiding this comment.
| # Don't let the runtime environment of comiler like dependencies leak into the | |
| # Don't let the runtime environment of compiler-like dependencies leak into the |
There was a problem hiding this comment.
Haven't you heard about the co-miler?
| pkg.setup_run_environment(env) | ||
| pkg.setup_dependent_run_environment(run_env_mods, spec) | ||
| pkg.setup_run_environment(run_env_mods) | ||
| if self.context == Context.BUILD: |
There was a problem hiding this comment.
Add a TODO here to handle this better when we have proper "compiler" dependencies, mention this is a stopgap
|
Heh ok looks like Tom beat me to it. This is good -- we DO need to sort out how this will work with compiler deps. |
…uild environment (spack#40916) * Test that setup_run_environment changes to CC/CXX/FC/F77 are dropped in build env * compilers set in run env shouldn't impact build Adds `drop` to EnvironmentModifications courtesy of @haampie, and uses it to clear modifications of CC, CXX, F77 and FC made by `setup_{,dependent_}run_environment` routines when producing an environment in BUILD context. * comment / style * comment --------- Co-authored-by: Tom Scogland <[email protected]>
…uild environment (spack#40916) * Test that setup_run_environment changes to CC/CXX/FC/F77 are dropped in build env * compilers set in run env shouldn't impact build Adds `drop` to EnvironmentModifications courtesy of @haampie, and uses it to clear modifications of CC, CXX, F77 and FC made by `setup_{,dependent_}run_environment` routines when producing an environment in BUILD context. * comment / style * comment --------- Co-authored-by: Tom Scogland <[email protected]>
|
We used setup_run_environment() to clear modifications to PATH. This change breaks that. Is there any way we can now unset PATH modifications for a package? It is set by _make_runnable() and can no longer be unset by setup_run_environment() with env.clear(). Edit: Ah. An explicit removal with env.remove_path() works :-) |
When depending on libllvm or libgcc as a build/link type dep, we don't want
their
setup_run_environmentchanges to modify CC / CXX / F77 / FC, sinceSpack determines the actual compiler and should manage those variables.
We still want module files to be generated with those CC / CXX / F77 / FC
variables, so it would be wrong to remove those variables from
setup_run_environment.The alternative would be to setup the compiler env changes last, but quite
some packages already rely on setting CXX in
setup_build_environment,and we also don't want to break that.