Repository: spack/spack

Issue:
Installation issue: virtualgl ^libjpeg fails (only seems to work with libjpeg-turbo)
<!-- 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! -->

The virtualgl package lists a virtual dependency on 'jpeg', which has providers libjpeg and libjpeg-turbo.   However, virtualgl seems to only be able to build with libjpeg-turbo.

### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install virtualgl ^libturbo
```
fails with errors like 
```console
CMake Error at cmakescripts/FindTurboJPEG.cmake:16 (message):
  Could not find turbojpeg.h in /opt/libjpeg-turbo/include.  If it is
  installed in a different place, then set TJPEG_INCLUDE_DIR accordingly.
Call Stack (most recent call first):
  CMakeLists.txt:311 (include)
```

Bulding against libjpeg-turbo, e.g.
```console
$ spack install virtualgl ^libturbo-jpeg
```
is successful.

I made a quick attempt to hack the package.py to set TJPEG_INCLUDE_DIR and TJPEG_LIBRARY to point to the libjpeg include and libraries, but this still generates errors:

```console
    65    -- X Video support disabled (VGL_USEXV = 0)
  >> 66    CMake Error at cmakescripts/FindTurboJPEG.cmake:16 (message):
     67      Could not find turbojpeg.h in
     68      /software/spack-software/2020.05.14/linux-rhel8-ivybridge/gcc-8.4.0/libjpeg-9c-5upfo56ajuvhkiw5krysf43w3jgzzcy4/include.
     69      If it is installed in a different place, then set TJPEG_INCLUDE_DIR
```
since of course libjpeg does not have a turbojpeg.h include.

A simple solution would be to change the dependency from a virtual dependency on jpeg to a concrete dependency on libjpeg-turbo.   A better solution would be to patch the virtualgl build stuff to accept either libjpeg or libjpeg-turbo, but that is more work than I can deal with right now.  I am not sure if other packages have similar issues.

### Information on your system

<!-- Please include the output of `spack debug report` -->

```console
$ spack debug report
* **Spack:** 0.14.2
* **Python:** 3.6.8
* **Platform:** linux-rhel8-ivybridge
```

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<!-- Please upload the following files. They should be present in the stage directory of the failing build. Also upload any config.log or similar file if one exists. -->
* [spack-build-env.txt](https://github.com/spack/spack/files/5502754/spack-build-env.txt)
* [spack-build-out.txt](https://github.com/spack/spack/files/5502755/spack-build-out.txt)


<!-- Some packages have maintainers who have volunteered to debug build failures. Run `spack maintainers <name-of-the-package>` and @mention them here if they exist. -->
No maintainers found

### 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
- [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



Discussion:
I'm fine with the simple solution if you want to submit a PR for that.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/virtualgl/package.py b/var/spack/repos/builtin/packages/virtualgl/package.py
--- a/var/spack/repos/builtin/packages/virtualgl/package.py
+++ b/var/spack/repos/builtin/packages/virtualgl/package.py
@@ -18,5 +18,6 @@ class Virtualgl(CMakePackage):
 
     version('2.5.2', sha256='4f43387678b289a24139c5b7c3699740ca555a9f10011c979e51aa4df2b93238')
 
-    depends_on("jpeg")
+    # This package will only work with libjpeg-turbo, not other jpeg providers
+    depends_on("libjpeg-turbo")
     depends_on("glu")


Test patch: