Repository: spack/spack

Issue:
Installation issue: py-scipy@1.7.0 complains about missing libgomp on macOS 11.14.6.
`py-scipy` fails to build/install on my local machine (macOS 11.4.6, x86_64). If installed with `spack install -v py-scipy`, version 1.7.0 complains about a missing `libgomp`.

Mentioning maintainer: @adamjstewart

### 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 py-scipy
...
```

### Information on your system

```
* **Spack:** 0.16.2-3641-270fbf8231
* **Python:** 3.8.10
* **Platform:** darwin-bigsur-skylake
* **Concretizer:** original
```

### Additional information

[spack-build-out.txt](https://github.com/spack/spack/files/6878752/spack-build-out.txt)

### 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 corrected the wrong macOS version number in the issue-title. 

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-pythran/package.py b/var/spack/repos/builtin/packages/py-pythran/package.py
--- a/var/spack/repos/builtin/packages/py-pythran/package.py
+++ b/var/spack/repos/builtin/packages/py-pythran/package.py
@@ -3,6 +3,8 @@
 #
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 
+import sys
+
 from spack import *
 
 
@@ -42,3 +44,33 @@ class PyPythran(PythonPackage):
     depends_on('py-beniget@0.2.1:0.2.999', when='@0.9.6', type=('build', 'run'))
     depends_on('py-beniget@0.2.0:', when='@0.9.4:0.9.5', type=('build', 'run'))
     depends_on('py-beniget', when='@:0.9.3', type=('build', 'run'))
+    depends_on('llvm-openmp', when='%apple-clang', type=('build', 'run'))
+
+    patch('https://patch-diff.githubusercontent.com/raw/serge-sans-paille/pythran/pull/1856.patch',
+          sha256='18f5e8985d636ad9c73b2f96b601aae299e0c315aa4c0dbee7b2599a63177218',
+          when='@0.9.10:0.9.12')
+
+    def patch(self):
+        # Compiler is used at run-time to determine name of OpenMP library to search for
+        cfg_file = join_path('pythran', 'pythran-{0}.cfg'.format(sys.platform))
+        filter_file('CXX=', 'CXX=' + self.compiler.cxx, cfg_file)
+
+    def setup_build_environment(self, env):
+        # Needed for `spack install --test=root py-pythran`
+        if self.spec.satisfies('%apple-clang'):
+            env.prepend_path(
+                'DYLD_FALLBACK_LIBRARY_PATH',
+                self.spec['llvm-openmp'].libs.directories[0]
+            )
+
+    def setup_run_environment(self, env):
+        # Needed for `spack test run py-pythran`
+        self.setup_build_environment(env)
+
+    def setup_dependent_build_environment(self, env, dependent_spec):
+        # Needed for `spack install py-scipy`
+        self.setup_build_environment(env)
+
+    def setup_dependent_run_environment(self, env, dependent_spec):
+        # Probably needed for something?
+        self.setup_build_environment(env)


Test patch: