Repository: spack/spack

Issue:
Installation issue: qt
### Steps to reproduce the issue

```console
$ spack spec -I qt@5.15.11
Input spec
--------------------------------
 -   qt@5.15.11

Concretized
--------------------------------
 -   qt@5.15.11%apple-clang@15.0.0~dbus~debug~doc~examples+framework~gtk+gui~opengl~phonon+shared+sql+ssl+tools~webkit build_system=generic patches=51aeba5,7f34d48,c2d75d9 arch=darwin-sonoma-m1
[+]      ^double-conversion@3.3.0%apple-clang@15.0.0~ipo build_system=cmake build_type=Release generator=make arch=darwin-sonoma-m1
[+]          ^cmake@3.27.8%apple-clang@15.0.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=darwin-sonoma-m1
[+]              ^curl@8.4.0%apple-clang@15.0.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=secure_transport arch=darwin-sonoma-m1
[+]                  ^nghttp2@1.57.0%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]          ^gmake@4.4.1%apple-clang@15.0.0~guile build_system=generic arch=darwin-sonoma-m1
[+]      ^freetype@2.10.2%apple-clang@15.0.0+pic+shared build_system=autotools arch=darwin-sonoma-m1
[+]          ^bzip2@1.0.8%apple-clang@15.0.0~debug~pic+shared build_system=generic arch=darwin-sonoma-m1
[+]              ^diffutils@3.9%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]          ^gnuconfig@2022-09-17%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]      ^glib@2.78.0%apple-clang@15.0.0~libmount~strip build_system=meson buildtype=release default_library=shared patches=2c25d7b tracing=none arch=darwin-sonoma-m1
[+]          ^gettext@0.22.4%apple-clang@15.0.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=darwin-sonoma-m1
[+]              ^tar@1.34%apple-clang@15.0.0 build_system=autotools zip=pigz arch=darwin-sonoma-m1
[+]                  ^pigz@2.7%apple-clang@15.0.0 build_system=makefile arch=darwin-sonoma-m1
[+]          ^libelf@0.8.13%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]              ^autoconf@2.69%apple-clang@15.0.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=darwin-sonoma-m1
[+]              ^automake@1.16.5%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]              ^libtool@2.4.7%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]              ^m4@1.4.19%apple-clang@15.0.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=darwin-sonoma-m1
[+]                  ^libsigsegv@2.14%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]          ^libffi@3.4.4%apple-clang@15.0.0 build_system=autotools patches=070b1f3 arch=darwin-sonoma-m1
[+]          ^libiconv@1.17%apple-clang@15.0.0 build_system=autotools libs=shared,static arch=darwin-sonoma-m1
[+]          ^meson@1.2.2%apple-clang@15.0.0 build_system=python_pip patches=0f0b1bd,ae59765 arch=darwin-sonoma-m1
[+]              ^py-pip@23.1.2%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]              ^py-setuptools@68.0.0%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]              ^py-wheel@0.41.2%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]          ^ninja@1.11.1%apple-clang@15.0.0+re2c build_system=generic arch=darwin-sonoma-m1
[+]              ^re2c@2.2%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]          ^perl@5.38.0%apple-clang@15.0.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=darwin-sonoma-m1
[+]              ^berkeley-db@18.1.40%apple-clang@15.0.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=darwin-sonoma-m1
[+]      ^harfbuzz@7.3.0%apple-clang@15.0.0~coretext~graphite2~strip build_system=meson buildtype=release default_library=shared arch=darwin-sonoma-m1
[+]          ^cairo@1.16.0%apple-clang@15.0.0~X~fc+ft+gobject+pdf+pic~png+shared~svg build_system=autotools patches=7c4da77 arch=darwin-sonoma-m1
[+]              ^pixman@0.42.2%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]              ^which@2.21%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]          ^gobject-introspection@1.76.1%apple-clang@15.0.0~strip build_system=meson buildtype=release default_library=shared arch=darwin-sonoma-m1
[+]              ^bison@3.8.2%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]              ^flex@2.6.3%apple-clang@15.0.0+lex~nls build_system=autotools arch=darwin-sonoma-m1
[+]                  ^findutils@4.9.0%apple-clang@15.0.0 build_system=autotools patches=440b954 arch=darwin-sonoma-m1
[+]              ^sed@4.9%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]      ^icu4c@67.1%apple-clang@15.0.0 build_system=autotools cxxstd=11 arch=darwin-sonoma-m1
[+]      ^libjpeg-turbo@3.0.0%apple-clang@15.0.0~ipo~jpeg8~partial_decoder+shared+static build_system=cmake build_type=Release generator=make arch=darwin-sonoma-m1
[+]          ^nasm@2.15.05%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]      ^libmng@2.0.3%apple-clang@15.0.0~ipo build_system=cmake build_type=Release generator=make arch=darwin-sonoma-m1
[+]          ^lcms@2.13.1%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]      ^libpng@1.6.39%apple-clang@15.0.0~ipo~pic build_system=cmake build_type=Release generator=make libs=shared,static arch=darwin-sonoma-m1
[+]      ^libtiff@4.5.1%apple-clang@15.0.0+ccitt~ipo~jbig+jpeg~jpeg12~lerc~libdeflate+logluv~lzma+lzw+next~old-jpeg+packbits~pic~pixarlog+shared+thunder~webp+zlib~zstd build_system=cmake build_type=Release generator=make arch=darwin-sonoma-m1
[+]      ^libxml2@2.10.3%apple-clang@15.0.0+pic~python+shared build_system=autotools arch=darwin-sonoma-m1
[+]          ^xz@5.4.1%apple-clang@15.0.0~pic build_system=autotools libs=shared,static arch=darwin-sonoma-m1
[+]      ^openssl@3.1.3%apple-clang@15.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-sonoma-m1
[+]          ^ca-certificates-mozilla@2023-05-30%apple-clang@15.0.0 build_system=generic arch=darwin-sonoma-m1
[+]      ^pcre2@10.42%apple-clang@15.0.0~jit+multibyte build_system=autotools arch=darwin-sonoma-m1
[+]      ^pkgconf@1.9.5%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]      ^python@3.11.6%apple-clang@15.0.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=darwin-sonoma-m1
[e]          ^apple-libuuid@1353.100.2%apple-clang@15.0.0 build_system=bundle arch=darwin-sonoma-m1
[+]          ^expat@2.5.0%apple-clang@15.0.0~libbsd build_system=autotools arch=darwin-sonoma-m1
[+]          ^gdbm@1.23%apple-clang@15.0.0 build_system=autotools arch=darwin-sonoma-m1
[+]          ^libxcrypt@4.4.35%apple-clang@15.0.0~obsolete_api build_system=autotools patches=4885da3 arch=darwin-sonoma-m1
[+]          ^ncurses@6.4%apple-clang@15.0.0~symlinks+termlib abi=none build_system=autotools arch=darwin-sonoma-m1
[+]          ^readline@8.2%apple-clang@15.0.0 build_system=autotools patches=bbf97f1 arch=darwin-sonoma-m1
[+]      ^sqlite@3.43.2%apple-clang@15.0.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=darwin-sonoma-m1
[+]      ^zlib-ng@2.1.4%apple-clang@15.0.0+compat+opt build_system=autotools arch=darwin-sonoma-m1
[+]      ^zstd@1.5.5%apple-clang@15.0.0+programs build_system=makefile compression=none libs=shared,static arch=darwin-sonoma-m1
```


### Error message

<details><summary>Error message</summary>

<pre>
==> Installing qt-5.15.11-khrb3tjjcj6cd2cvlkdkb4wez64vh4z2 [38/38]
==> No binary for qt-5.15.11-khrb3tjjcj6cd2cvlkdkb4wez64vh4z2 found: installing from source
==> Using cached archive: /Users/benwibking/spack/var/spack/cache/_source-cache/archive/74/7426b1eaab52ed169ce53804bdd05dfe364f761468f888a0f15a308dc1dc2951.tar.xz
==> Applied patch /Users/benwibking/spack/var/spack/repos/builtin/packages/qt/qt5-pcre.patch
==> Applied patch /Users/benwibking/spack/var/spack/repos/builtin/packages/qt/qt5-macos12.patch
==> Applied patch /Users/benwibking/spack/var/spack/repos/builtin/packages/qt/qt59-qtbase-qtconfig256.patch
==> qt: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 3:
    './configure' '-prefix' '/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/qt-5.15.11-khrb3tjjcj6cd2cvlkdkb4wez64vh4z2' '-v' '-opensource' '-no-opengl' '-release' '-confirm-license' '-optimized-qmake' '-no-pch' '-system-freetype' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/freetype-2.10.2-auhefdnhxhcregep4c7nlcxiyivbl44s/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/freetype-2.10.2-auhefdnhxhcregep4c7nlcxiyivbl44s/include/freetype2' '-openssl-linked' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openssl-3.1.3-dygdgbwb36dacukxuz4y6fnlju5zstmb/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/openssl-3.1.3-dygdgbwb36dacukxuz4y6fnlju5zstmb/include' '-system-sqlite' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/sqlite-3.43.2-64qxny4hmvpl7gtn222qc5spnl6oi3rq/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/sqlite-3.43.2-64qxny4hmvpl7gtn222qc5spnl6oi3rq/include' '-shared' '-system-pcre' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/pcre2-10.42-6owgfviqosybzik4w4uw55zbqp3rcqbn/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/pcre2-10.42-6owgfviqosybzik4w4uw55zbqp3rcqbn/include' '-system-harfbuzz' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/harfbuzz-7.3.0-hrkedu5xuuhk5w36fknhp4on5s2hayfa/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/harfbuzz-7.3.0-hrkedu5xuuhk5w36fknhp4on5s2hayfa/include' '-system-doubleconversion' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/double-conversion-3.3.0-outqtojaawb4npl77sy67d5q72eewgyf/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/double-conversion-3.3.0-outqtojaawb4npl77sy67d5q72eewgyf/include' '-system-libpng' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/libpng-1.6.39-75jaxjyyph2la67ke2cctlt2vzn5vmrk/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/libpng-1.6.39-75jaxjyyph2la67ke2cctlt2vzn5vmrk/include' '-system-libjpeg' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/libjpeg-turbo-3.0.0-n4ht2wqlfp2dwl5hzbalfadxad2chdga/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/libjpeg-turbo-3.0.0-n4ht2wqlfp2dwl5hzbalfadxad2chdga/include' '-system-zlib' '-L/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/zlib-ng-2.1.4-i47zbhbevychxcn6k5s3xxloacrzgh25/lib' '-I/Users/benwibking/spack/opt/spack/darwin-sonoma-m1/apple-clang-15.0.0/zlib-ng-2.1.4-i47zbhbevychxcn6k5s3xxloacrzgh25/include' '-nomake' 'examples' '-no-dbus' '-framework' '-platform' 'macx-clang' '-no-eglfs' '-no-directfb' '-no-gtk' '-skip' 'webengine' '-skip' 'wayland' '-skip' 'multimedia' '-skip' 'qt3d' '-skip' 'webglplugin' '-skip' 'qtquick3d' '-device-option' 'QMAKE_APPLE_DEVICE_ARCHS=arm64'
See build log for details:
  /tmp/benwibking/spack-stage/spack-stage-qt-5.15.11-khrb3tjjcj6cd2cvlkdkb4wez64vh4z2/spack-build-out.txt

</pre></details>


### Information on your system

* **Spack:** 0.22.0.dev0 (16bc58ea49256b061c7308565fe41c446e748881)
* **Python:** 3.11.6
* **Platform:** darwin-sonoma-m1
* **Concretizer:** clingo

### Additional information

[spack-build-out.txt](https://github.com/spack/spack/files/13573424/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/13573425/spack-build-env.txt)

@sethrj

### 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:
I also see this issue.  It is a roadblock to `spack install py-jupyter`. 
Can you look at whether this could be the issue? https://github.com/Homebrew/homebrew-core/issues/144051#issuecomment-1726248336, i.e. https://bugreports.qt.io/browse/QTBUG-117225. I don't have a mac to test on. 
> Can you look at whether this could be the issue? [Homebrew/homebrew-core#144051 (comment)](https://github.com/Homebrew/homebrew-core/issues/144051#issuecomment-1726248336), i.e. https://bugreports.qt.io/browse/QTBUG-117225. I don't have a mac to test on.

Yes, that's exactly what I'm seeing.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py
--- a/var/spack/repos/builtin/packages/qt/package.py
+++ b/var/spack/repos/builtin/packages/qt/package.py
@@ -150,6 +150,14 @@ class Qt(Package):
     )
     # https://github.com/microsoft/vcpkg/issues/21055
     patch("qt5-macos12.patch", working_dir="qtbase", when="@5.14: %apple-clang@13:")
+    # https://codereview.qt-project.org/c/qt/qtbase/+/503172
+    patch(
+        "https://github.com/qt/qtbase/commit/cdf64b0e47115cc473e1afd1472b4b09e130b2a5.patch?full_index=1",
+        sha256="2b881ffb2808f8fa79f51f8bec71be91a886bcdc59b1d7b6986cba26ed18d1d3",
+        working_dir="qtbase",
+        when="@5.12.1: %apple-clang@15:",
+    )
+    conflicts("%apple-clang@15:", when="@:5.12.0")
 
     # Spack path substitution uses excessively long paths that exceed the hard-coded
     # limit of 256 used by teh generated code with the prefix path as string literals


Test patch: