Repository: spack/spack

Issue:
Installation issue: gcc not building on macOS Monterey with M1
### Steps to reproduce the issue

Gcc is not building for me on Monetary on a new M1 MacBook Pro.
```console
$ spack install gcc@11.3.0
```

@alalazo @michaelkuhn 

### Error message

<details>
There seems to be a bootstrapping issue that needs to be ported.
<summary>Error message</summary><pre>
     551051    rm -f stage_current
     551052    Comparing stages 2 and 3
     551053    Bootstrap comparison failure!
     551054    aarch64-apple-darwin21.5.0/libstdc++-v3/src/.libs/libstdc++.6.dylib-master.o differs
  >> 551055    make[2]: *** [compare] Error 1
  >> 551056    make[1]: *** [stage3-bubble] Error 2
  >> 551057    make: *** [all] Error 2
</pre></details>


### Information on your system

```console
spack debug report
* **Spack:** 0.19.0.dev0 (bf990bc8ec2d6c51f7f40bc6b0f7fb3bba897a96)
* **Python:** 3.9.13
* **Platform:** darwin-monterey-m1
* **Concretizer:** clingo
```

### Additional information

[spack-build-env.txt](https://github.com/spack/spack/files/8928055/spack-build-env.txt)
[spack-build-out.txt.zip](https://github.com/spack/spack/files/8928061/spack-build-out.txt.zip)



### 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:
@sethrj Do you have cycles (and an M1) to look at this?
See https://github.com/spack/spack/pull/30825 : it may be just a matter of requiring `~bootstrap` on `platform=darwin target=aarch64:`. See also https://github.com/spack/spack/pull/29089#issuecomment-1045999632 .
@psakievich Can you see if `spack install gcc~bootstrap` works?
Also please update the description to show the output of `spack spec -I gcc` rather than just the command...
@sethrj trying a `~bootstrap` build now. Sorry about the command I was being a little lazy and just took the default command. `spack spec -I` has no issues. It's purely an install issue.  I tried `gcc@11.3.0` and `gcc` for the specs.
`gcc@11.3.0~bootstrap` works.  Should I update the gcc package to make this a conflict?
@psakievich , yeah why don't you add it right underneath the corresponding patch file on line 299.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -297,6 +297,7 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
         patch('https://raw.githubusercontent.com/Homebrew/formula-patches/22dec3fc/gcc/gcc-11.3.0-arm.diff',
               sha256='e02006b7ec917cc1390645d95735a6a866caed0dfe506d5bef742f7862cab218',
               when='@11.3.0 target=aarch64:')
+        conflicts('+bootstrap', when='@11.3.0 target=aarch64:')
 
         # Use -headerpad_max_install_names in the build,
         # otherwise updated load commands won't fit in the Mach-O header.


Test patch: