Repository: spack/spack

Issue:
dso_suffix not defined
When I try to build CMake (spec: `cmake@3.6.1%gcc@4.3.4 arch=linux-SuSE11-x86_64 ~doc+ncurses+openssl+ownlibs~qt`) with any commit since 2a823fb (meaning this commit is the last one that works) spack will fail with `NameError: global name 'dso_suffix' is not defined`. I noticed that dso_suffix is defined at the top of lib/spack/spack/build_environment.py and is referenced in (and failing at) line 57 of lib/spack/spack/abi.py. If I add `from build_environment import dso_suffix` to abi.py it seems to fix the issue. I'll open a PR if this is an appropriate fix.



Discussion:
I ran into this with cdo a minute ago. It may be that we are only hitting it on Crays. Can you reproduce on Rhea?

Also, I think you may be able to garner more interest with a different name for this issue. I would try 'dso_suffix not defined' or some such.

It seems to only be happening on the Crays, it seems to work fine on Rhea.

I am getting same error on `x86_64` linux cluster in below scenario: 

``` bash
○ → spack install -v mypkg@hdf +mpi %gcc@4.9.0 ^mvapich2

Traceback (most recent call last):
  File "/some-softwares/sources/spack/bin/spack", line 192, in <module>
    main()
  File "/some-softwares/sources/spack/bin/spack", line 169, in main
    return_val = command(parser, args)
  File "/some-softwares/sources/spack/lib/spack/spack/cmd/install.py", line 311, in install
    specs = spack.cmd.parse_specs(args.package, concretize=True)
  File "/some-softwares/sources/spack/lib/spack/spack/cmd/__init__.py", line 106, in parse_specs
    spec.concretize()  # implies normalize
  File "/some-softwares/sources/spack/lib/spack/spack/spec.py", line 1326, in concretise
......
  File "/some-softwares/sources/spack/lib/spack/spack/abi.py", line 79, in _gcc_compiler_compare
    plib = self._gcc_get_libstdcxx_version(pversion)
  File "/some-softwares/sources/spack/lib/spack/llnl/util/lang.py", line 187, in __call__
    self.cache[args] = self.func(*args)
  File "/some-softwares/sources/spack/lib/spack/spack/abi.py", line 57, in _gcc_get_libstdcxx_version
    libname = "libstdc++." + dso_suffix
NameError: global name 'dso_suffix' is not defined
```

My `packages.yaml` has following : 

``` bash
    hdf5:
        paths:
            hdf5@1.10.0%gcc@5.2.0: /gpfs-project-path/hdf5-gcc
            hdf5@1.10.0%gcc@4.9.0: /gpfs-project-path/hdf5-gcc
            hdf5@1.10.0%intel@17.0.0: /gpfs-project-path/hdf5-icc
        variants: ~fortran ~shared ~cxx
        buildable: False
        version: [1.10.0]
    zlib:
        paths:
            zlib@1.2.8%gcc@5.2.0: /gpfs-project-path/zlib-gcc
            zlib@1.2.8%gcc@4.9.0: /gpfs-project-path/zlib-gcc
            zlib@1.2.8%intel@17.0.0: /gpfs-project-path/zlib-icc
        buildable: False
        version: [1.2.8]
    all:
        compiler: [gcc@5.2.0, gcc@4.9.0, intel@17.0.0]
```

Once I remove related entries for `gcc@5.2.0` then everything concretise fine. 

I ran into this error as well. I believe I've found the issue and I'm issuing a pull request for my fix.


Resolving patch:
diff --git a/lib/spack/spack/abi.py b/lib/spack/spack/abi.py
--- a/lib/spack/spack/abi.py
+++ b/lib/spack/spack/abi.py
@@ -26,6 +26,7 @@
 import os
 import spack
 import spack.spec
+from spack.build_environment import dso_suffix
 from spack.spec import CompilerSpec
 from spack.util.executable import Executable, ProcessError
 from llnl.util.lang import memoized


Test patch: