Repository: spack/spack

Issue:
Installation issue: cuda package fails to locate linking library directory
<!-- Thanks for taking the time to report this build failure. To proceed with the report please:

1. Title the issue "Installation issue: <name-of-the-package>".
2. Provide the information required below.

We encourage you to try, as much as possible, to reduce your problem to the minimal example that still reproduces the issue. That would help us a lot in fixing it quickly and effectively! -->

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
# set up spack environment below
$ spack install
```
Relevant error message
```
==> Installing py-horovod
==> No binary for py-horovod found: installing from source
==> Error: IndexError: list index out of range

/usr/WS2/blake14/spack/var/spack/repos/builtin/packages/py-horovod/package.py:118, in setup_build_environment:
        115            env.set('HOROVOD_CUDA_HOME', self.spec['cuda'].prefix)
        116            env.set('HOROVOD_CUDA_INCLUDE',
        117                    self.spec['cuda'].headers.directories[0])
  >>    118            env.set('HOROVOD_CUDA_LIB', self.spec['cuda'].libs.directories[0])
        119
        120            env.set('HOROVOD_NCCL_HOME', self.spec['nccl'].prefix)
        121            env.set('HOROVOD_NCCL_INCLUDE',

```

### Information on your system

* **Spack:** 0.15.3-489-2f0fd44
* **Python:** 3.7.2
* **Platform:** linux-rhel7-power9le

spack.yaml
```
spack:
  packages:
    all:
      providers:
        mpi:
        - spectrum-mpi@0.0.1
        lapack:
        - openblas
        blas:
        - openblas
      buildable: true
      version: []
      compiler:
      - gcc@8.3.1
      target: []
    openblas:
      compiler: []
      buildable: true
      version: []
      target: []
      providers: {}
    cmake:
      variants: ~openssl ~ncurses
      version:
      - 3.16.8
      target: []
      compiler: []
      buildable: true
      providers: {}
      externals:
      - spec: cmake@3.16.8
        prefix: /usr/tce/packages/cmake/cmake-3.16.8
    cuda:
      buildable: false
      version:
      - 10.1.243
      target: []
      compiler: []
      providers: {}
      externals:
      - spec: cuda@10.1.243
        prefix: /usr/tce/packages/cuda/cuda-10.1.243
    py-torch:
      buildable: true
      variants: +cuda +distributed cuda_arch=72
      version: []
      target: []
      compiler: []
      providers: {}
    nccl:
      variants: +cuda cuda_arch=72
      version: []
      target: []
      compiler: []
      buildable: true
      providers: {}
    cudnn:
      version:
      - 7.6.5.32-10.1-linux-ppc64le
      target: []
      compiler: []
      buildable: true
      providers: {}
    spectrum-mpi:
      buildable: false
      version:
      - 0.0.1
      target: []
      compiler: []
      providers: {}
      externals:
      - spec: spectrum-mpi@0.0.1%gcc@8.3.1
        prefix: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-8.3.1
  compilers:
  - compiler:
      spec: gcc@8.3.1
      paths:
        cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc
        cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++
        f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran
        fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran
      flags: {}
      operating_system: rhel7
      target: ppc64le
      modules: []
      environment:
        unset: []
      extra_rpaths: []
  specs:
  - python
  - py-torch
  - py-horovod
  - py-pandas
  - py-scipy
  - py-h5py
  - py-scikit-learn
  - py-matplotlib
  - py-pillow
```

### Additional information

Problem occurs here in the cuda package:
```
    @property
    def libs(self):
        libs = find_libraries('libcuda', root=self.prefix, shared=True,
                              recursive=True)

        filtered_libs = []
        # CUDA 10.0 provides Compatability libraries for running newer versions
        # of CUDA with older drivers. These do not work with newer drivers.
        for lib in libs:
            parts = lib.split(os.sep)
            if 'compat' not in parts and 'stubs' not in parts:
                filtered_libs.append(lib)
        return LibraryList(filtered_libs)
```

Commit 54bce00d on 2020-07-24 broke this, while fixing issue #17607 with PR #17619

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files (N/A)
- [X] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py
--- a/var/spack/repos/builtin/packages/cuda/package.py
+++ b/var/spack/repos/builtin/packages/cuda/package.py
@@ -132,7 +132,7 @@ def install(self, spec, prefix):
 
     @property
     def libs(self):
-        libs = find_libraries('libcuda', root=self.prefix, shared=True,
+        libs = find_libraries('libcudart', root=self.prefix, shared=True,
                               recursive=True)
 
         filtered_libs = []


Test patch: