Repository: spack/spack

Issue:
Installation issue: netcdf-cxx4
<!-- 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.
### Steps to reproduce the issue
netcdf-cxx4@4.3.1%gcc@8.4.0 +dap +doxygen +jna +ncgen4 +netcdf4 +pic ~pnetcdf +shared +static arch=linux-rhel8-x86_64
fails with an error:
     28     ==> 29125: netcdf-cxx4: Executing phase: 'configure'
     29     ==> [2020-05-19-11:44:18.476779, 29134] '/tmp/payerle/spack-stage/spack-stage-netcdf-c
            xx4-4.3.1-ubzluaakvqaghjnlpdpr4cz4oy4kv5su/spack-src/configure' 'CFLAGS=-fPIC' 'CPPFLA
            GS=-I/software/spack-software/2020.05.14/linux-rhel8-x86_64/gcc-8.4.0/netcdf-c-4.7.3-l
            lhykha5mn7j5lg5fhrepujjgvfsei3j/include' '--prefix=/software/spack-software/2020.05.14
            /linux-rhel8-x86_64/gcc-8.4.0/netcdf-cxx4-4.3.1-ubzluaakvqaghjnlpdpr4cz4oy4kv5su' '--enable-static' '--enable-shared' '--with-pic' '--enable-dap' '--enable-jna' '--disable-pnetcdf' '--enable-netcdf-4' '--enable-ncgen4' '--enable-doxygen'
  >> 30     configure: WARNING: unrecognized options: --enable-dap, --enable-jna, --disable-pnetcdf, --enable-netcdf-4, --enable-ncgen4

In particular, it looks like #16047 (commit 993491c ) added new variants fir dap, jna, etc. but the netcdf-cxx4 configure script does not support them.  I.e., in addition to above error, running configure --help in stage directory (for either 4.3.0 or 4.3.1) does not show any such options.


<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install <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

<!-- 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-out.txt]()
* [spack-build-env.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. -->

### 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:
@WardF
* **Spack:** 0.14.2-1112-445cae5c8
[spack-build-env.txt](https://github.com/spack/spack/files/4652590/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/4652591/spack-build-out.txt)
[spack-configure-args.txt](https://github.com/spack/spack/files/4652592/spack-configure-args.txt)
* **Python:** 3.6.8
* **Platform:** linux-rhel8-x86_64

Getting a failure on netcdf-cxx4 due to illegal configure args.

E.g., 
spack install netcdf-cxx4@4.3.1%gcc@8.4.0 +dap +doxygen +jna +ncgen4 +netcdf4 +pic ~pnetcdf +shared +static arch=linux-rhel8-x86_64

Dies with error
    28     ==> 29125: netcdf-cxx4: Executing phase: 'configure'
     29     ==> [2020-05-19-11:44:18.476779, 29134] '/tmp/payerle/spack-stage/spack-stage-netcdf-c
            xx4-4.3.1-ubzluaakvqaghjnlpdpr4cz4oy4kv5su/spack-src/configure' 'CFLAGS=-fPIC' 'CPPFLA
            GS=-I/software/spack-software/2020.05.14/linux-rhel8-x86_64/gcc-8.4.0/netcdf-c-4.7.3-l
            lhykha5mn7j5lg5fhrepujjgvfsei3j/include' '--prefix=/software/spack-software/2020.05.14
            /linux-rhel8-x86_64/gcc-8.4.0/netcdf-cxx4-4.3.1-ubzluaakvqaghjnlpdpr4cz4oy4kv5su' '--enable-static' '--enable-shared' '--with-pic' '--enable-dap' '--enable-jna' '--disable-pnetcdf' '--enable-netcdf-4' '--enable-ncgen4' '--enable-doxygen'
  >> 30     configure: WARNING: unrecognized options: --enable-dap, --enable-jna, --disable-pnetcdf, --enable-netcdf-4, --enable-ncgen4

Basically, it looks like #16047/commit  993491c added new variants and corresponding config args for netcdf-cxx4, but the added configure args are not supported by the netcdf-cxx4 configure script (I checked both 4.3.0 and 4.3.1; --enable-jna, et al. do not appear in configure --help for either version)
These arguments appear to be for the netcdf-c library configuration script.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/netcdf-cxx4/package.py b/var/spack/repos/builtin/packages/netcdf-cxx4/package.py
--- a/var/spack/repos/builtin/packages/netcdf-cxx4/package.py
+++ b/var/spack/repos/builtin/packages/netcdf-cxx4/package.py
@@ -24,12 +24,7 @@ class NetcdfCxx4(AutotoolsPackage):
     variant('static', default=True, description='Enable building static libraries')
     variant('shared', default=True, description='Enable shared library')
     variant('pic', default=True, description='Produce position-independent code (for shared libs)')
-    variant('dap', default=False, description='Enable DAP support')
-    variant('jna', default=False, description='Enable JNA support')
     variant('doxygen', default=True, description='Enable doxygen docs')
-    variant('ncgen4', default=True, description='Enable generating netcdf-4 data')
-    variant('pnetcdf', default=True, description='Enable parallel-netcdf')
-    variant('netcdf4', default=False, description='Enable netcdf-4 data structure')
 
     depends_on('netcdf-c')
 
@@ -75,31 +70,6 @@ def configure_args(self):
         else:
             config_args.append('--without-pic')
 
-        if '+dap' in self.spec:
-            config_args.append('--enable-dap')
-        else:
-            config_args.append('--disable-dap')
-
-        if '+jna' in self.spec:
-            config_args.append('--enable-jna')
-        else:
-            config_args.append('--disable-jna')
-
-        if '+pnetcdf' in self.spec:
-            config_args.append('--enable-pnetcdf')
-        else:
-            config_args.append('--disable-pnetcdf')
-
-        if '+netcdf4' in self.spec:
-            config_args.append('--enable-netcdf-4')
-        else:
-            config_args.append('--disable-netcdf-4')
-
-        if '+ncgen4' in self.spec:
-            config_args.append('--enable-ncgen4')
-        else:
-            config_args.append('--disable-ncgen4')
-
         if '+doxygen' in self.spec:
             config_args.append('--enable-doxygen')
         else:


Test patch: