Repository: spack/spack

Issue:
Installation issue: suite-sparse (possibly intel-tbb issue?)
<!-- 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
spack install suite-sparse@5.7.2%gcc@8.4.0 +cuda +openmp +pic +tbb arch=linux-rhel8-x86_64

with our virtual tbb package set to tbb: [intel-tbb@2018.3] in package.py

results in error
==> 21880: suite-sparse: Building suite-sparse [Package]
==> 21880: suite-sparse: Executing phase: 'install'
==> Error: NoLibrariesError: Unable to recursively locate intel-tbb libraries in /software/spack-software/2020.05.14/linux-rhel8-x86_64/gcc-8.4.0/intel-tbb-2018.3-xdjisurfypoyubmiarjswhwme36iobhp

/software/spack/git.2020.05.14/var/spack/repos/builtin/packages/suite-sparse/package.py:133, in install:
        130            print(pformat(spec['tbb']))
        131            make_args += [
        132                'SPQR_CONFIG=-DHAVE_TBB',
  >>    133                'TBB=%s' % spec['tbb'].libs.ld_flags,
        134            ]
        135
        136        if '@5.3:' in spec:

### Information on your system

<!-- Please include the output of `spack debug report` -->

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information
spack debug report
* **Spack:** 0.14.2
* **Python:** 3.8.2
* **Platform:** linux-rhel8-x86_64

[spack-build-env.txt](https://github.com/spack/spack/files/4725137/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/4725138/spack-build-out.txt)

(No maintainers found for either suite-sparse or intel-tbb)

### General information

- [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
- [x ] I have uploaded the build log and environment files
- [x ] I have searched the issues of this repo and believe this is not a duplicate

I have looked into the "Unable to recursively locate intel-tbb libraries" and saw mention 
of something that might be related in
https://spack-tutorial.readthedocs.io/en/latest/tutorial_advanced_packaging.html#providing-libraries-to-dependents

If I understand things correctly, the intel-tbb package does not explicitly provide a 'libs' method and so inherits the default, which will look for libtbb-intel.* libraries instead of the libtbb.* libraries provided by the package.

I will attempt to add a patch, but I am not sure if I am doing it write



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py
--- a/var/spack/repos/builtin/packages/intel-tbb/package.py
+++ b/var/spack/repos/builtin/packages/intel-tbb/package.py
@@ -132,22 +132,22 @@ def coerce_to_spack(self, tbb_build_subdir):
             for f in fs:
                 lines = open(f).readlines()
                 of = open(f, "w")
-                for l in lines:
-                    if l.strip().startswith("CPLUS ="):
+                for lin in lines:
+                    if lin.strip().startswith("CPLUS ="):
                         of.write("# coerced to spack\n")
                         of.write("CPLUS = $(CXX)\n")
-                    elif l.strip().startswith("CONLY ="):
+                    elif lin.strip().startswith("CONLY ="):
                         of.write("# coerced to spack\n")
                         of.write("CONLY = $(CC)\n")
                     else:
-                        of.write(l)
+                        of.write(lin)
 
     def install(self, spec, prefix):
         # Deactivate use of RTM with GCC when on an OS with a very old
         # assembler.
         if (spec.satisfies('%gcc@4.8.0: os=rhel6')
-            or spec.satisfies('%gcc@4.8.0: os=centos6')
-            or spec.satisfies('%gcc@4.8.0: os=scientific6')):
+                or spec.satisfies('%gcc@4.8.0: os=centos6')
+                or spec.satisfies('%gcc@4.8.0: os=scientific6')):
             filter_file(r'RTM_KEY.*=.*rtm.*', 'RTM_KEY =',
                         join_path('build', 'linux.gcc.inc'))
 
@@ -224,3 +224,9 @@ def darwin_fix(self):
         # Replace @rpath in ids with full path
         if sys.platform == 'darwin':
             fix_darwin_install_name(self.prefix.lib)
+
+    @property
+    def libs(self):
+        shared = True if '+shared' in self.spec else False
+        return find_libraries(
+            'libtbb*', root=self.prefix, shared=shared, recursive=True)


Test patch: