Repository: spack/spack

Issue:
Installation issue: meson packages can't strip on macOS
So far, I've noticed that this bug affects the following packages:

* at-spi2-atk
* at-spi2-core
* atk
* gdk-pixbuf

It likely affects all meson packages on macOS.

### Steps to reproduce the issue

```console
$ spack install at-spi2-core
...
Stripping target 'atspi/libatspi.0.dylib' using strip.
Could not strip file.

Stdout:


Stderr:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: error: symbols referenced by indirect symbol table entries that can't be stripped in: /Users/Adam/spack/opt/spack/darwin-catalina-x86_64/apple-clang-12.0.0/at-spi2-core-2.38.0-kgbdezwlu3gy4ahg64ekaeqtjhei2ehn/lib/libatspi.0.dylib
```

### Information on your system

* **Spack:** 0.15.4-1763-3576953558
* **Python:** 3.8.6
* **Platform:** darwin-catalina-ivybridge

### Additional information

@michaelkuhn have you ever seen anything like this before? I tried the latest version of meson, ninja, and these 3 packages, but I can't seem to fix them. Homebrew doesn't have any patches either.

### 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
- [ ] 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:
This suggests that different args for `strip` are needed on macOS: https://github.com/pybind/pybind11/issues/595

Not sure if this is a bug to report to meson, or ninja, or the other packages that use them.
This suggests that it may actually be intentional (I think I understand why we were patching meson now): https://github.com/mesonbuild/meson/issues/6541

Do we need to be patching in another place too?
I tried removing our meson patches for 0.55.0 and 0.56.0 but I still see the same error.
Same bug occurs with meson 0.54.3, so it's not like 0.55 completely broke RPATH stripping.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/at-spi2-core/package.py b/var/spack/repos/builtin/packages/at-spi2-core/package.py
--- a/var/spack/repos/builtin/packages/at-spi2-core/package.py
+++ b/var/spack/repos/builtin/packages/at-spi2-core/package.py
@@ -12,13 +12,15 @@ class AtSpi2Core(MesonPackage):
        against which applications can be linked."""
 
     homepage = "http://www.linuxfromscratch.org/blfs/view/cvs/x/at-spi2-core.html"
-    url      = "http://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.28/at-spi2-core-2.28.0.tar.xz"
+    url      = "http://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.28/at-spi2-core-2.38.0.tar.xz"
     list_url = "http://ftp.gnome.org/pub/gnome/sources/at-spi2-core"
     list_depth = 1
 
+    version('2.38.0', sha256='84e36c3fe66862133f5fe229772b76aa2526e10de5014a3778f2fa46ce550da5')
     version('2.36.0', sha256='88da57de0a7e3c60bc341a974a80fdba091612db3547c410d6deab039ca5c05a')
     version('2.28.0', sha256='42a2487ab11ce43c288e73b2668ef8b1ab40a0e2b4f94e80fca04ad27b6f1c87')
 
+    depends_on('meson@0.46.0:', type='build')
     depends_on('glib@2.56.1:')
     depends_on('dbus@1.12.8:')
     depends_on('gettext')
diff --git a/var/spack/repos/builtin/packages/glib/package.py b/var/spack/repos/builtin/packages/glib/package.py
--- a/var/spack/repos/builtin/packages/glib/package.py
+++ b/var/spack/repos/builtin/packages/glib/package.py
@@ -171,11 +171,6 @@ def configure_args(self):
         args.append('GTKDOC_REBASE={0}'.format(true))
         return args
 
-    def setup_build_environment(self, env):
-        if self.spec.satisfies('platform=darwin'):
-            # https://github.com/pybind/pybind11/issues/595
-            env.set('STRIP', 'strip -x')
-
     @when('@:2.57.99')
     def install(self, spec, prefix):
         configure('--prefix={0}'.format(prefix), *self.configure_args())
diff --git a/var/spack/repos/builtin/packages/meson/package.py b/var/spack/repos/builtin/packages/meson/package.py
--- a/var/spack/repos/builtin/packages/meson/package.py
+++ b/var/spack/repos/builtin/packages/meson/package.py
@@ -48,3 +48,8 @@ class Meson(PythonPackage):
     @classmethod
     def determine_version(cls, exe):
         return Executable(exe)('--version', output=str, error=str).rstrip()
+
+    def setup_dependent_build_environment(self, env, dependent_spec):
+        # https://github.com/pybind/pybind11/issues/595
+        if self.spec.satisfies('platform=darwin'):
+            env.set('STRIP', 'strip -x')


Test patch: