Repository: spack/spack

Issue:
Installation issue: scorpio error with apple-clang@12:
### Steps to reproduce the issue

```console
$ spack spec -l scorpio
Input spec
--------------------------------
scorpio

Concretized
--------------------------------
rnynd3p  scorpio@2021-12-10%apple-clang@13.0.0~ipo build_type=RelWithDebInfo arch=darwin-bigsur-skylake
rz3rype      ^cmake@3.22.1%apple-clang@13.0.0~doc+ncurses+ownlibs~qt build_type=Release arch=darwin-bigsur-skylake
qevc7zd      ^hdf5@1.12.1%apple-clang@13.0.0~cxx~fortran+hl~ipo~java+mpi+shared~szip~threadsafe+tools api=default build_type=RelWithDebInfo patches=ee351eb arch=darwin-bigsur-skylake
2ghsxed          ^openmpi@4.1.3%apple-clang@13.0.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~pmi~pmix+romio~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath fabrics=none schedulers=none arch=darwin-bigsur-skylake
wxwotj4              ^hwloc@2.7.1%apple-clang@13.0.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~opencl~pci~rocm+shared arch=darwin-bigsur-skylake
o3kv7g7                  ^libxml2@2.9.12%apple-clang@13.0.0~python arch=darwin-bigsur-skylake
fu7tfsr                      ^libiconv@1.16%apple-clang@13.0.0 libs=shared,static arch=darwin-bigsur-skylake
wn7ml75                      ^pkg-config@0.29.2%apple-clang@13.0.0+internal_glib arch=darwin-bigsur-skylake
opwhawx                      ^xz@5.2.5%apple-clang@13.0.0~pic libs=shared,static arch=darwin-bigsur-skylake
fmhpso7                      ^zlib@1.2.12%apple-clang@13.0.0+optimize+pic+shared patches=0d38234 arch=darwin-bigsur-skylake
xdbaqeo                  ^ncurses@6.2%apple-clang@13.0.0~symlinks+termlib abi=none arch=darwin-bigsur-skylake
t5lh5jd              ^libevent@2.1.12%apple-clang@13.0.0+openssl arch=darwin-bigsur-skylake
bte724q                  ^openssl@1.1.1n%apple-clang@13.0.0~docs~shared certs=system arch=darwin-bigsur-skylake
ayneiqf                      ^perl@5.34.1%apple-clang@13.0.0+cpanm+shared+threads arch=darwin-bigsur-skylake
xgt3tls                          ^berkeley-db@18.1.40%apple-clang@13.0.0+cxx~docs+stl patches=b231fcc arch=darwin-bigsur-skylake
65edjf6                          ^bzip2@1.0.8%apple-clang@13.0.0~debug~pic+shared arch=darwin-bigsur-skylake
662adoo                              ^diffutils@3.8%apple-clang@13.0.0 arch=darwin-bigsur-skylake
vjg67nd                          ^gdbm@1.19%apple-clang@13.0.0 arch=darwin-bigsur-skylake
tjceldr                              ^readline@8.1%apple-clang@13.0.0 arch=darwin-bigsur-skylake
yhxbwl4              ^openssh@8.1p1%apple-clang@13.0.0 arch=darwin-bigsur-skylake
```


### Error message

<details><summary>Error message</summary><pre>
 >> 49    /var/folders/ck/bwzqcv_s1pz1t9fc86731shh0000gq/T/ptb/spack-stage/spack-s
           tage-scorpio-2021-12-10-mixlwanqdz2tcdaesj53ublagyg7viwr/spack-src/src/s
           corpioftn.c:240:10: error: implicit declaration of function 'scorpio_wri
           te_dataset_block' is invalid in C99 [-Werror,-Wimplicit-function-declara
           tion]
</pre></details>


### Information on your system

* **Spack:** 0.18.0.dev0 (13f3bd533dfac3c226fd644bfbe8243070c3f7a9)
* **Python:** 3.9.12
* **Platform:** darwin-bigsur-skylake
* **Concretizer:** clingo

### Additional information

_No response_

### 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/scorpio/package.py b/var/spack/repos/builtin/packages/scorpio/package.py
--- a/var/spack/repos/builtin/packages/scorpio/package.py
+++ b/var/spack/repos/builtin/packages/scorpio/package.py
@@ -27,3 +27,10 @@ class Scorpio(CMakePackage):
     depends_on('cmake@3.16:', type='build')
     depends_on('mpi')
     depends_on('hdf5@1.10.6: +hl +mpi')
+
+    def cmake_args(self):
+        opts = []
+        if self.spec.satisfies('%apple-clang@12:'):
+            opts.append(self.define("CMAKE_C_FLAGS",
+                                    "-Wno-error=implicit-function-declaration"))
+        return opts


Test patch: