Repository: spack/spack

Issue:
cuda gcc conflicts not working
The conflicts in the the cuda build system are not working. For example, the libbeagle package uses the cuda build system.

```
class Libbeagle(AutotoolsPackage, CudaPackage):
```

```console
$ spack --env-dir ../spack-configs/argon/2019.1/environments/gcc_packages/ spec libbeagle
libbeagle@3.1.2%gcc@9.1.0+cuda cuda_arch=35,60,61,70,75 arch=linux-centos7-sandybridge
    ^autoconf@2.69%gcc@9.1.0 arch=linux-centos7-sandybridge
        ^m4@1.4.18%gcc@9.1.0 patches=3877ab548f88597ab2327a2230ee048d2d07ace1062efe81fc92e91b7f39cd00,fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8 +sigsegv arch=linux-centos7-sandybridge
            ^libsigsegv@2.12%gcc@9.1.0 arch=linux-centos7-sandybridge
        ^perl@5.30.0%gcc@9.1.0+cpanm+shared+threads arch=linux-centos7-sandybridge
            ^gdbm@1.18.1%gcc@9.1.0 arch=linux-centos7-sandybridge
                ^readline@8.0%gcc@9.1.0 arch=linux-centos7-sandybridge
                    ^ncurses@6.1%gcc@9.1.0~symlinks~termlib arch=linux-centos7-sandybridge
                        ^pkgconf@1.6.3%gcc@9.1.0 arch=linux-centos7-sandybridge
    ^automake@1.16.1%gcc@9.1.0 arch=linux-centos7-sandybridge
    ^cuda@10.1.243%gcc@9.1.0 arch=linux-centos7-sandybridge
...
```
The libbeagle build will then fail with
```
..
            /targets/x86_64-linux/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are
            not supported!
```
That should have been prevented with the conflicts statement in the cuda build system.
```
conflicts('%gcc@8:', when='+cuda ^cuda@10.0.130' + arch_platform)
```
where arch_platform  = ' arch=x86_64 platform=linux'.

It would also seem that cuda itself should not install with a gcc > 8 as well. 


Discussion:

Resolving patch:
diff --git a/lib/spack/spack/build_systems/cuda.py b/lib/spack/spack/build_systems/cuda.py
--- a/lib/spack/spack/build_systems/cuda.py
+++ b/lib/spack/spack/build_systems/cuda.py
@@ -56,11 +56,12 @@ def cuda_flags(arch_list):
 
     # Linux x86_64 compiler conflicts from here:
     # https://gist.github.com/ax3l/9489132
-    arch_platform = ' arch=x86_64 platform=linux'
+    arch_platform = ' target=x86_64: platform=linux'
     conflicts('%gcc@5:', when='+cuda ^cuda@:7.5' + arch_platform)
     conflicts('%gcc@6:', when='+cuda ^cuda@:8' + arch_platform)
     conflicts('%gcc@7:', when='+cuda ^cuda@:9.1' + arch_platform)
-    conflicts('%gcc@8:', when='+cuda ^cuda@10.0.130' + arch_platform)
+    conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130' + arch_platform)
+    conflicts('%gcc@9:', when='+cuda ^cuda@:10.1.243' + arch_platform)
     conflicts('%pgi@:14.8', when='+cuda ^cuda@:7.0.27' + arch_platform)
     conflicts('%pgi@:15.3,15.5:', when='+cuda ^cuda@7.5' + arch_platform)
     conflicts('%pgi@:16.2,16.0:16.3', when='+cuda ^cuda@8' + arch_platform)
@@ -82,10 +83,11 @@ def cuda_flags(arch_list):
     # https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html
     # https://docs.nvidia.com/cuda/archive/8.0/cuda-installation-guide-linux/index.html
 
-    arch_platform = ' arch=ppc64le platform=linux'
+    arch_platform = ' target=ppc64le: platform=linux'
     # information prior to CUDA 9 difficult to find
     conflicts('%gcc@6:', when='+cuda ^cuda@:9' + arch_platform)
-    conflicts('%gcc@8:', when='+cuda ^cuda@10.0.130' + arch_platform)
+    conflicts('%gcc@8:', when='+cuda ^cuda@:10.0.130' + arch_platform)
+    conflicts('%gcc@9:', when='+cuda ^cuda@:10.1.243' + arch_platform)
     conflicts('%pgi', when='+cuda ^cuda@:8' + arch_platform)
     conflicts('%pgi@:16', when='+cuda ^cuda@:9.1.185' + arch_platform)
     conflicts('%pgi@:17', when='+cuda ^cuda@:10' + arch_platform)


Test patch: