Repository: spack/spack

Issue:
Installation issue: octave
When building octave 6.1.0 with fltk support, there is no build error, but the resulting build does not use fltk.

### 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 octave@6.1.0  +fftw  +fontconfig +freetype +gnuplot +curl +fltk
...
```
Lack of fltk functionality can be verified by running the octave-6.1.0 binary, and checking the value of available_graphics_toolkits(). It will be found that only the gnuplot toolkit is available, i.e. the fltk support was not linked into the binary.

### Information on your system

<!-- Please include the output of `spack debug report` -->
* **Spack:** 0.16.0-1262-0724467ad2
* **Python:** 3.8.5
* **Platform:** linux-ubuntu20.04-skylake
* **Concretizer:** original

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<https://octave.1599824.n4.nabble.com/Octave-3-4-2-with-fltk-support-td3627783.html> indicates that mesa support must be available at link time in order for fltk support to be functional. Probably mesa should be added as a dependency for fltk.

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [ x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:
@mtmiller 
Do you happen to have a full build log that we can look at to see what configure worked out?

My guess is that the spack fltk package doesn't pull in opengl, which octave does require.
I'm a new spack user. I see scant mention of build logs in the documentation. Some indication that there might be one in /tmp, but I've rebooted since I built.

I'm happy to rebuild, and generate a log. Can you tell me where to look for it?
I don't know much about spack myself, @adamjstewart can you help get a full configure/build log?
If the build fails, Spack will print the location of the build log. If the build succeeds, Spack will print the installation directory. This can also be found with `spack find -p`. In the installation directory, there is a `.spack` directory containing the build log, config.log, build environment, and other useful files. 
Thanks. Build log attached, along with packages.yaml from ~/.spack. Please ignore previously uploaded files in this message; they didn't have the correct build configuration for the problem I'm trying to demonstrate.

[spack-build-out.txt](https://github.com/spack/spack/files/6024731/spack-build-out.txt)
[packages.yaml.zip](https://github.com/spack/spack/files/6024732/packages.yaml.zip)

The top of the build log indicates that octave is being built with fltk support, but without opengl. So I think @mtmiller is correct in his diagnosis.

I experimented with forcing spack to use a system-supplied version of fltk, but octave still doesn't pull in the opengl libraries (although they are also installed on the system).

I don't know whether the fltk package should require opengl, or whether the octave package should provide another option to pull in opengl.


Yes, I think `+fltk` should implicitly add the `+opengl` flag as well, as it seems to be doing for `+qt`.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/octave/package.py b/var/spack/repos/builtin/packages/octave/package.py
--- a/var/spack/repos/builtin/packages/octave/package.py
+++ b/var/spack/repos/builtin/packages/octave/package.py
@@ -88,12 +88,13 @@ class Octave(AutotoolsPackage, GNUMirrorPackage):
     depends_on('gnuplot',      when='+gnuplot')
     depends_on('imagemagick',  when='+magick')
     depends_on('hdf5',         when='+hdf5')
-    depends_on('java',          when='+jdk')        # TODO: requires Java 6 ?
+    depends_on('java',         when='+jdk')        # TODO: requires Java 6 ?
     depends_on('llvm',         when='+llvm')
-    # depends_on('opengl',      when='+opengl')    # TODO: add package
+    depends_on('gl',           when='+opengl')
+    depends_on('gl',           when='+fltk')
     depends_on('qhull',        when='+qhull')
     depends_on('qrupdate',     when='+qrupdate')
-    # depends_on('qscintilla',  when='+qscintilla) # TODO: add package
+    depends_on('qscintilla',   when='+qscintilla')
     depends_on('qt+opengl',    when='+qt')
     depends_on('suite-sparse', when='+suitesparse')
     depends_on('zlib',         when='+zlib')
@@ -239,7 +240,7 @@ def configure_args(self):
         else:
             config_args.append("--disable-java")
 
-        if '~opengl' in spec:
+        if '~opengl' and '~fltk' in spec:
             config_args.extend([
                 "--without-opengl",
                 "--without-framework-opengl"


Test patch: