spack: Specifying modules in compilers.yaml doesn't preserve ENV variables
This was discussed/mentioned in the #2037. In short, when I specify module in compilers.yaml and if that module is setting some ENV variables like LD_LIBRARY_PATH then those are not preserved.
Summary:
pramodk:
if I specify modules in compilers.yaml, does all env variables from those modules will be set and preserved during build? Or this also requires --dirty ?
tgamblin:
@pramodk: if you specify modules in the compilers.yaml file, they should be imported into the build environment even without --dirty. Spack has (as of the Cray support) the ability to load modules just in the build environment. @mamelara @becker33: do you know why that might not be working? This is on a Linux machine – did you test there?
pramodk:
In my testing it’s not working as expected. Here is detailed example (x86_redhat_cluster):
I have
gccmodule which looks like this:module show gcc/4.9.0 ------------------------------------------------------------------- /home/modulefiles/gcc/4.9.0: module-whatis Loads gcc 4.9.0 to your environment variables module load mpc/1.0.2 module load mpfr/3.1.2 module load gmp/5.1.3 prepend-path PATH /home//tools/gcc/gcc-4.9.0/install/bin prepend-path LD_LIBRARY_PATH /home//tools/gcc/gcc-4.9.0/install/lib64 prepend-path LD_RUN_PATH /home//tools/gcc/gcc-4.9.0/install/lib64 prepend-path CPATH /home//tools/gcc/gcc-4.9.0/install/include prepend-path SEARCH_DIR /home//tools/gcc/gcc-4.9.0/install/lib64If I use that above compiler directly (without loading module), I get following error:
/home//tools/gcc/gcc-4.9.0/install/bin/gcc example.c /home/tools/gcc/gcc-4.9.0/install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directorySo
LD_LIBRARY_PATHis not set formpcand hence the error which is expected.Now I add entry into
compilers.yamlas:- compiler: modules: [gcc/4.9.0, mpc/1.0.2, mpfr/3.1.2, gmp/5.1.3] operating_system: redhat6 paths: cc: /home/tools/gcc/gcc-4.9.0/install/bin/gcc cxx: /home/tools/gcc/gcc-4.9.0/install/bin/g++ f77: /home/tools/gcc/gcc-4.9.0/install/bin/gfortran fc: /home/tools/gcc/gcc-4.9.0/install/bin/gfortran spec: gcc@4.9.0(I also tried adding only gcc/4.9.0).
If I try to build a package, I see following error in
pack-build.out:$ spack install -v testpkg %gcc@4.9.0 /home/tools/gcc/gcc-4.9.0/install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directoryI haven’t loaded any module or set any path yet. But if I just run with
--dirtyflag:spack install -v --dirty testpkg %gcc@4.9.0Now the package build successfully! My understanding was that the
--dirtyflag will be only useful if I load any modules or set any env variables.If I check
spack-build.envin above two cases,LD_LIBRARY_PATHis set properly / preserved if I use--dirtyflag (even without loading any module or setting path explicitly).
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 20 (20 by maintainers)
@citibeth @alalazo: fun fact: the compiler wrappers were originally in Python. See 0f3b80cddbfd775c10f68423444aca792525f856. Python startup overhead is really expensive, especially if your python install is on a shared filesystem. As I recall making this change sped the builds up by as much as 6x.