Repository: spack/spack

Issue:
Installation issue: nss %clang
### Steps to reproduce the issue

nss fails to build on clang/aocc because it properly detects clang as its C compiler, but it runs g++ as its C++ compiler with clang parameters.

```console
$ spack spec -l nss%clang@11.0.0
Input spec
--------------------------------
nss%clang@11.0.0

Concretized
--------------------------------
swoz4wh  nss@3.73%clang@11.0.0 arch=linux-ubuntu20.04-haswell
ucr34xo      ^nspr@4.32%clang@11.0.0 arch=linux-ubuntu20.04-haswell
ceapj5u          ^perl@5.34.0%clang@11.0.0+cpanm+shared+threads arch=linux-ubuntu20.04-haswell
gcvqmoo              ^berkeley-db@18.1.40%clang@11.0.0+cxx~docs+stl patches=b231fcc arch=linux-ubuntu20.04-haswell
nwrmiuf              ^bzip2@1.0.8%clang@11.0.0~debug~pic+shared arch=linux-ubuntu20.04-haswell
bahha3s                  ^diffutils@3.8%clang@11.0.0 arch=linux-ubuntu20.04-haswell
jew5ui7                      ^libiconv@1.16%clang@11.0.0 libs=shared,static arch=linux-ubuntu20.04-haswell
tr5uqop              ^gdbm@1.19%clang@11.0.0 arch=linux-ubuntu20.04-haswell
rmtx2ep                  ^readline@8.1%clang@11.0.0 arch=linux-ubuntu20.04-haswell
3t4cjtt                      ^ncurses@6.2%clang@11.0.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-haswell
dlktc2h                          ^pkgconf@1.8.0%clang@11.0.0 arch=linux-ubuntu20.04-haswell
5vhpnmw              ^zlib@1.2.11%clang@11.0.0+optimize+pic+shared arch=linux-ubuntu20.04-haswell
himedlx      ^sqlite@3.37.2%clang@11.0.0+column_metadata+dynamic_extensions+fts~functions+rtree arch=linux-ubuntu20.04-haswell
```


### Error message

<details><summary>Error message</summary><pre>
     1846    g++ -o Linux5.4_x86_64_clang_glibc_PTH_64_OPT.OBJ/databuffer.o -c -std=c++11 -O2 -fPIC  -m64 -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -Qunused-arguments -Wno-parentheses-equali
             ty -Wno-array-bounds -Wno-unevaluated-expression -Werror -DXP_UNIX -DXP_UNIX -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -DSDB_MEASURE_USE_TEMP_DIR -D_REENTRANT -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_
             SOURCE -D_POSIX_SOURCE -DSDB_MEASURE_USE_TEMP_DIR -D_REENTRANT -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/tmp/bc/spack-stage/spack-stage-nss-3.73-swoz4whrnd2
             auw3cosubfpeoec3tg6rv/spack-src/dist/include -I/tmp/bc/spack-stage/spack-stage-nss-3.73-swoz4whrnd2auw3cosubfpeoec3tg6rv/spack-src/dist/public/nss -I/tmp/bc/spack-stage/spack-stage-nss-3.73-swoz4whrnd2auw3cosubfpeoec3tg6rv/s
             pack-src/dist/private/nss  -std=c++0x databuffer.cc
  >> 1847    g++: error: unrecognized command line option '-Qunused-arguments'
  >> 1848    make[2]: *** [../coreconf/rules.mk:349: Linux5.4_x86_64_clang_glibc_PTH_64_OPT.OBJ/databuffer.o] Error 1
     1849    make[2]: Leaving directory '/tmp/bc/spack-stage/spack-stage-nss-3.73-swoz4whrnd2auw3cosubfpeoec3tg6rv/spack-src/nss/cpputil'
  >> 1850    make[1]: *** [coreconf/rules.mk:44: cpputil] Error 2
     1851    make[1]: Leaving directory '/tmp/bc/spack-stage/spack-stage-nss-3.73-swoz4whrnd2auw3cosubfpeoec3tg6rv/spack-src/nss'
  >> 1852    make: *** [manifest.mn:21: all] Error 2
</pre></details>


### Information on your system

* **Spack:** 0.17.1-1338-a027b5b6ad
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-haswell
* **Concretizer:** clingo

### Additional information

[spack-build-out.txt](https://github.com/spack/spack/files/8138615/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/8138616/spack-build-env.txt)



### 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


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/nss/package.py b/var/spack/repos/builtin/packages/nss/package.py
--- a/var/spack/repos/builtin/packages/nss/package.py
+++ b/var/spack/repos/builtin/packages/nss/package.py
@@ -38,6 +38,7 @@ def build_targets(self):
         # We cannot use nss_build_all because this will try to build nspr.
         targets = ['all', 'latest']
 
+        targets.append('CCC={}'.format(spack_cxx))
         targets.append('USE_64=1')
         targets.append('BUILD_OPT=1')
 


Test patch: