#73037 closed defect (fixed)
qt6-qtwebengine@6.9.2 build fails: alleged missing Metal Toolchain
| Reported by: | murrayE | Owned by: | reneeotten (Renee Otten) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.11.5 |
| Keywords: | tahoe | Cc: | MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), markmentovai (Mark Mentovai), i0ntempest, markemer (Mark Anderson) |
| Port: | qt6-qtwebengine |
Description
Under macOS Tahow 26.0 on ARM64, I'm trying to redo failed installation of qt6 sub-ports mcalhounfrom the sudo port migrate (migration from Sequoia).
From main.log:
:info:build /opt/local/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13 ../../../../../qtwebengine-everywhere-src-6.9.2/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/metal_wrapper.py xcrun metal -c ../../../../../qtwebengine-everywhere-src-6.9.2/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/mtl_internal_shaders_autogen.metal -o gen/angle/mtl_internal_shaders_autogen.air --std=macos-metal2.1 -mmacosx-version-min=10.14 :info:build error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
However, I did install Metaltoolchain using xcodebuild, and Xcode > Settings > Components does show Metal Toolchain 26.0 (17A324) as installed.
Attachments (4)
Change History (42)
Changed 5 months ago by murrayE
comment:1 Changed 5 months ago by reneeotten (Renee Otten)
| Cc: | reneeotten removed |
|---|---|
| Keywords: | tahoe added; Tahoe ARM64 removed |
| Owner: | set to reneeotten |
| Status: | new → assigned |
Yes, I am aware of that, have the same issue on Intel, and not found a solution yet.
comment:2 follow-up: 3 Changed 5 months ago by dlamija (Muhammed Ramiza)
with a MetalToolchain install it still givee an error looking for metallib file
:info:build FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metallib'
unfortunately there are not metallib but metal installed
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
comment:3 follow-up: 4 Changed 5 months ago by reneeotten (Renee Otten)
Replying to dlamija:
with a MetalToolchain install it still givee an error looking for metallib file
:info:build FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metallib'unfortunately there are not metallib but metal installed
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal
That could be the case, but it's according the error message not what causes the build to fail.
21938 :info:build error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
can you please upload a full build log - it seems you make it further in the build then me/us?
comment:4 Changed 5 months ago by dlamija (Muhammed Ramiza)
Replying to reneeotten:
can you please upload a full build log - it seems you make it further in the build then me/us?
Actually xcodebuild -downloadComponent MetalToolchain had been used.
let me upload the main.log
Changed 5 months ago by dlamija (Muhammed Ramiza)
| Attachment: | main.2.log added |
|---|
main.log that search for metallib
comment:5 follow-up: 7 Changed 5 months ago by reneeotten (Renee Otten)
It doesn't look like you uploaded the correct log file, there is no mention of metallib in there nor a build of qt6-qtwebengine.
Please do sudo port clean --all qt6-qtwebengine ; sudo port -dv install qt6-qtwebengine and if that fails (it will...), then add the log file that is mentioned in the error message to this ticket.
comment:6 Changed 5 months ago by reneeotten (Renee Otten)
I already the upstream patch that supposedly should fix the issue but that doesn't work for me...
It's strange... the error I see is:
:info:build /opt/local/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13 ../../../../../qtwebengine-everywhere-src-6.9.2/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/metal_wrapper.py xcrun metal -c ../../../../../qtwebengine-everywhere-src-6.9.2/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/mtl_internal_shaders_autogen.metal -o gen/angle/mtl_internal_shaders_autogen.air --std=macos-metal2.1 -mmacosx-version-min=10.14 :info:build error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
however, if I execute the command myself in a shell it does work correctly. To be continued...
comment:7 Changed 5 months ago by dlamija (Muhammed Ramiza)
Replying to reneeotten:
It doesn't look like you uploaded the correct log file, there is no mention of
metallibin there nor a build ofqt6-qtwebengine.Please do
sudo port clean --all qt6-qtwebengine ; sudo port -dv install qt6-qtwebengineand if that fails (it will...), then add the log file that is mentioned in the error message to this ticket.
Sorry my mistake; due to inspection on terminal, but whne upload drag from finder which happen open several location.
Since i already do all the cleaning, now unable to reproduce the same error. Sorry again
comment:8 Changed 5 months ago by reneeotten (Renee Otten)
comment:9 follow-up: 10 Changed 5 months ago by markmentovai (Mark Mentovai)
Hi. I fixed this in angle last week. You need to patch in https://chromium-review.googlesource.com/c/6955000 (angle 2f564f1ca07b1d2668d8639d98ea5ad51cc9cd35).
comment:10 Changed 5 months ago by reneeotten (Renee Otten)
Replying to markmentovai:
Hi. I fixed this in angle last week. You need to patch in https://chromium-review.googlesource.com/c/6955000 (angle 2f564f1ca07b1d2668d8639d98ea5ad51cc9cd35).
Thanks Mark! For some reason the patch I added does work correctly on Tahoe and arm64 but it doesn't work for me locally on Intel. I will take a look into that link you provided and give it a go. I appreciate your help!
comment:11 follow-up: 13 Changed 5 months ago by markmentovai (Mark Mentovai)
It looks like https://github.com/macports/macports-ports/commit/4f002852c924dc73501a68cc1080b7018e1eff9b only addresses the invocation of metallib, but https://chromium-review.googlesource.com/c/6955000 shows that you’ve got to handle metal too. Perhaps that’s why?
comment:12 Changed 5 months ago by markmentovai (Mark Mentovai)
| Cc: | markmentovai added |
|---|
comment:13 Changed 5 months ago by reneeotten (Renee Otten)
Replying to markmentovai:
It looks like https://github.com/macports/macports-ports/commit/4f002852c924dc73501a68cc1080b7018e1eff9b only addresses the invocation of
metallib, but https://chromium-review.googlesource.com/c/6955000 shows that you’ve got to handlemetaltoo. Perhaps that’s why?
As far as I can tell, the instance for metal was patched to use xcrun already in the downloaded package, only the metallib presumably needed patching. The part I don't understand anyways is why with the metallib patch it worked on the buildbot for arm64 but not locally for me on Intel ; that doesn't make sense, unless there is some subtle difference between full XCode / CLT installation.
Anyway, let's not worry about this right now. I will adapt the patch you linked above so that it applies to the Qt6QtWebengine source package and try to build locally. I'll report back here whether or not that worked!
comment:14 follow-up: 15 Changed 5 months ago by markmentovai (Mark Mentovai)
unless there is some subtle difference between full XCode / CLT installation.
I don't think you can use the Metal toolchain with CLT only. I think it takes a full Xcode, and then an installation of the Metal toolchain. Could that be relevant to your x86-64 build?
comment:15 Changed 5 months ago by reneeotten (Renee Otten)
Replying to markmentovai:
unless there is some subtle difference between full XCode / CLT installation.
I don't think you can use the Metal toolchain with CLT only. I think it takes a full Xcode, and then an installation of the Metal toolchain. Could that be relevant to your x86-64 build?
No, it cannot as the Portfile sets use_xcode yes so it will only work with a full XCode installation. The strange thing is that the same symptom (i.e., it builds on the buildbot after installing the Metal toolchain, but not locally for people) also seems to happen for the openjdk21 port 73008. I don't think we fully understand why that is happening yet...
comment:16 Changed 5 months ago by reneeotten (Renee Otten)
still fails for me locally with the new patch... I think the issue could be due to the presence of /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal, which seems strange to me (as I just mentioned in Trac 73008 as well. Do you have that file as well Mark?
comment:17 Changed 5 months ago by markmentovai (Mark Mentovai)
Do you have that file as well Mark?
Yes, that file is a part of Xcode.app, even at Xcode ≥ 26.0. In these newest versions of Xcode, …/XcodeDefault.xctoolchain/usr/bin/metal is really only capable of showing this message:
error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
This …/XcodeDefault.xctoolchain/usr/bin/metal is actually bit-for-bit identical to the metal driver at …/Metal.xctoolchain/usr/bin/metal (assuming the same version—the Metal toolchain is 26.0 17A324, and hasn’t been rebuilt to correspond to Xcode 26.0.1 17A400). The difference is that the one in Xcode.app’s XcodeDefault.xctoolchain no longer (since Xcode ≥ 26.0) has by …/usr/metal nearby, where the one in the independently installable Metal.xctoolchain does.
I haven’t tried this build on x86_64 yet but I can. It might be more expedient if you share the error you’re seeing?
comment:18 Changed 5 months ago by reneeotten (Renee Otten)
I fiddled around with things and messed up so the log is gone; I'll have to rebuild again. But the error is always the same:
error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
I will try to build again and upload the main.log here once finished.
I've also pushed the changes to my branch; if you don't mind to check whether the patch is correct. As I said, I needed to change it so that it would apply to the qtwebengine source archive. But I *think* I did so correctly.
comment:19 Changed 5 months ago by markmentovai (Mark Mentovai)
Your branch looks right to me, Renee.
No idea why qt would have fixed this for metallib but not metal, but they’ll catch up when they sync to the latest Chromium (including angle) again.
There’s another option if the Metal toolchain is too much trouble now: in the Chromium/angle bug report for this last week (https://crbug.com/445400016), I pointed out the possibility of using the metal_internal_shader_compilation_supported switch:
There’s also the possibility of throwing the metal_internal_shader_compilation_supported switch, which exists in part to support cross-compilation, where the Metal toolchain is not available. This was largely introduced in https://chromium-review.googlesource.com/c/4974918 (2023-10-25), but I presume we don’t want to forgo prebuilt shaders.
This option would prevent the angle build from using metal or metallib at all, at the expense of not prebuilding any Metal shaders. I didn’t want to give up on prebuilt shaders in Chromium, but it might not be so bad as a temporary measure here. Especially considering that MacPorts build environments are less controlled than Chromium/Chrome’s, and that there seem to be cross-user bugs around accessing the MetalToolchain cryptex, it might be the right compromise.
Changed 5 months ago by reneeotten (Renee Otten)
| Attachment: | main.3.log added |
|---|
main.log after final patch
comment:20 Changed 5 months ago by markmentovai (Mark Mentovai)
It seems like everything remaining here that’s relevant is being discussed in greater detail on bug 73008. In general, try comment 22: run xcodebuild -showComponent MetalToolchain as your MacPorts user. Additionally, for x86-64, try comment 28: if another user has mounted the MetalToolchain filesystem, have them unmount it: diskutil eject $(xcodebuild -showComponent MetalToolchain | sed -E -n -e 's/^Toolchain Search Path: (.*)$/\1/p').
comment:21 Changed 5 months ago by murrayE
| Summary: | qt6-webengine@6.9.2 build fails: alleged missing Metal Toolchain → qt6-qtwebengine@6.9.2 build fails: alleged missing Metal Toolchain |
|---|
comment:23 Changed 5 months ago by i0ntempest
| Cc: | i0ntempest added |
|---|
comment:24 Changed 5 months ago by markemer (Mark Anderson)
| Cc: | markemer added |
|---|
comment:25 Changed 5 months ago by dlamija (Muhammed Ramiza)
qt60qtwebnwgine 6.9.2 instlled successfully with current patch. Unfortunately the package had been updated to 6.9.3 which produce the same problem again.
:info:build FAILED: [code=1] gen/angle/mtl_internal_shaders_autogen.air :info:build /opt/local/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13 ../../../../../qtwebengine-everywhere-src-6.9.3/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/metal_wrapper.py xcrun metal -c ../../../../../qtwebengine-everywhere-src-6.9.3/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/mtl_internal_shaders_autogen.metal -o gen/angle/mtl_internal_shaders_autogen.air --std=macos-metal2.1 -mmacosx-version-min=10.14 :info:build error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
comment:26 Changed 5 months ago by jhoyt4
I'm experiencing the same issue. 6.9.2 finally installed, but 6.9.3 shows the error @dlamija reported.
comment:27 Changed 5 months ago by markemer (Mark Anderson)
It's funny, I had an issue system wide with xcrun metal giving that error, but I managed to fix it, but I still get that error when building 6.9.3
Edit: Gonna give a proper clean a try as I see there is a patch file that should fix things.
Edit 2: So, the gn file does appear to be patched but it appears to fail at the same place in libANGLE, weird. Continuing to investigate.
comment:28 Changed 4 months ago by yesyves
I have this error happening for the first time with 6.10.0 today
Changed 4 months ago by yesyves
| Attachment: | main.4.log added |
|---|
comment:29 Changed 4 months ago by markemer (Mark Anderson)
Yeah, I can't seem to upgrade 6.9.2 to 6.9.3 or 6.10.0, despite being able to run xcrun metal at the command line for a while, and it being mounted via cryptexd.
comment:30 Changed 4 months ago by jhoyt4
no joy with 6.10.0
[15/15806] ACTION //third_party/angle/src/libANGLE/renderer/metal:angle_metal_internal_shaders_to_air(//build/toolchain/mac:clang_arm64) FAILED: [code=1] gen/angle/mtl_internal_shaders_autogen.air /opt/local/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13 ../../../../../qtwebengine-everywhere-src-6.10.0/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/metal_wrapper.py xcrun metal -c ../../../../../qtwebengine-everywhere-src-6.10.0/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/mtl_internal_shaders_autogen.metal -o gen/angle/mtl_internal_shaders_autogen.air --std=macos-metal2.1 -mmacosx-version-min=10.14 error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
comment:31 Changed 4 months ago by markmentovai (Mark Mentovai)
See bug 73008 comment 54. I gave recovery steps there that will hopefully work for everyone.
comment:32 follow-up: 33 Changed 4 months ago by murrayE
After applying the method from https://trac.macports.org/ticket/73008#comment:54, the buil still failed when I attempted to upgrade to qt6-qtwebengine @ 6.10.0_0 under macOS Tahoe 26.0.1 on an M4 Mac.
comment:33 Changed 4 months ago by markmentovai (Mark Mentovai)
Replying to murrayE:
After applying the method from https://trac.macports.org/ticket/73008#comment:54, the buil still failed when I attempted to upgrade to qt6-qtwebengine @ 6.10.0_0 under macOS Tahoe 26.0.1 on an M4 Mac.
“Still failed” on its own isn’t much to go on.
I’ll show you how I did this. If you follow all of these commands in the right order and it still doesn’t work for you, can you share the output of what you see to help troubleshoot?
(Yeah, it’s a lot. But there are several things that can go wrong with this, particularly in a multi-user scenario, and going through everything methodically and showing all work really helps verify that all of the steps were followed to the letter, and helps pinpoint where any problems might exist if any part of the process needs to be refined.)
admin@axilla zsh% sw_vers
ProductName: macOS
ProductVersion: 26.0.1
BuildVersion: 25A362
admin@axilla zsh% xcodebuild -version
Xcode 26.0.1
Build version 17A400
admin@axilla zsh% arch
arm64
admin@axilla zsh% system_profiler SPHardwareDataType | grep -E 'Model Identifier|Chip'
Model Identifier: Mac16,5
Chip: Apple M4 Max
admin@axilla zsh% xcodebuild -downloadComponent MetalToolchain
Beginning asset download...
Downloaded asset to: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg
Done downloading: Metal Toolchain 17A324.
admin@axilla zsh% xcodebuild -showComponent MetalToolchain
Asset Path: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData
Build Version: 17A324
Status: installed
Toolchain Identifier: com.apple.dt.toolchain.Metal.32023
Toolchain Search Path: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS
admin@axilla zsh% sudo ls -l ~macports/Library/Developer/Xcode/XcodeToMetalToolchainIndexMapping.plist
-rw-r--r-- 1 macports macports 442 Oct 24 14:08 /opt/local/var/macports/home/Library/Developer/Xcode/XcodeToMetalToolchainIndexMapping.plist
admin@axilla zsh% sudo --user=macports xcodebuild -showComponent MetalToolchain
Asset Path: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData
Build Version: 17A324
Status: installed
Toolchain Identifier: com.apple.dt.toolchain.Metal.32023
Toolchain Search Path: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS
admin@axilla zsh% sudo ls -l ~macports/Library/Developer/Xcode/XcodeToMetalToolchainIndexMapping.plist
-rw-r--r-- 1 macports macports 442 Oct 24 14:14 /opt/local/var/macports/home/Library/Developer/Xcode/XcodeToMetalToolchainIndexMapping.plist
admin@axilla zsh% sudo --user=macports xcodebuild -find metal
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS/Metal.xctoolchain/usr/bin/metal
admin@axilla zsh% sudo --user=macports xcrun --find metal
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS/Metal.xctoolchain/usr/bin/metal
admin@axilla zsh% sudo rm -f "$(sudo --user=macports getconf DARWIN_USER_TEMP_DIR)/xcrun_db"
admin@axilla zsh% sudo --user=macports xcrun --find metal
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS/Metal.xctoolchain/usr/bin/metal
admin@axilla zsh% sudo --user=macports xcrun metal --version
Apple metal version 32023.830 (metalfe-32023.830.2)
Target: air64-apple-darwin25.0.0
Thread model: posix
InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.1.324.0.t40qgS/Metal.xctoolchain/usr/metal/current/bin
admin@axilla zsh% sudo --preserve-groups port install qt6-qtwebengine
---> Fetching distfiles for qt6-qtwebengine
---> Attempting to fetch qtwebengine-everywhere-src-6.10.0.tar.xz from https://distfiles.macports.org/qt6
---> Verifying checksums for qt6-qtwebengine
---> Extracting qt6-qtwebengine
---> Applying patches to qt6-qtwebengine
---> Configuring qt6-qtwebengine
---> Building qt6-qtwebengine
---> Staging qt6-qtwebengine into destroot
---> Installing qt6-qtwebengine @6.10.0_0
---> Activating qt6-qtwebengine @6.10.0_0
---> Cleaning qt6-qtwebengine
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
comment:34 Changed 4 months ago by murrayE
The build succeeded now when I followed also the steps in the displayed code following "Done" at https://trac.macports.org/ticket/73008#comment:54
comment:35 Changed 4 months ago by jhoyt4
@markmentovai - That got me back up and running. Thank you.
comment:36 Changed 4 months ago by reneeotten (Renee Otten)
thanks Mark - this indeed worked! I will update the Wiki page with your instructions.
comment:37 Changed 4 months ago by reneeotten (Renee Otten)
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
see TahoeProblems for a workaround. Likely upcoming MacPorts and XCode versions will resolve this completely.

main.log