Opened 11 months ago
Last modified 6 weeks ago
#73180 reopened request
Retry macOS 26 builds on buildbot with Xcode 26 Metal toolchain fix in place
| Reported by: | markmentovai (Mark Mentovai) | Owned by: | ryandesign (Ryan Carsten Schmidt) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | breun (Nils Breunese), reneeotten (Renee Otten), jmroot (Joshua Root), Dave-Allured (Dave Allured), axonde (Axonde ✦), EvilJordan (Jordan Holberg) | |
| Port: | qt6-qtwebengine, openjdk17, openjdk21, openjdk25 |
Description
MacPorts 2.11.6 contains 4497293e70b1, the fix for #73160, which should make it significantly easier to build ports that depend on the Metal toolchain using Xcode 26.
It would be good to get the ports known to be affected by this problem built on the buildbot.
On the buildbot, assuming it’s updated to MacPorts 2.11.6, run:
% xcodebuild -downloadComponent MetalToolchain
While still using Xcode 26.0 or 26.0.1, additionally run:
% sudo --user=macports xcodebuild -showComponent MetalToolchain % sudo rm -f "$(sudo --user=macports getconf DARWIN_USER_TEMP_DIR)/xcrun_db"
Then re-attempt builds for the following ports—links are to previous failing builds:
Change History (59)
comment:1 Changed 11 months ago by ryandesign (Ryan Carsten Schmidt)
comment:2 Changed 10 months ago by jmroot (Joshua Root)
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
All builds were successful.
comment:3 Changed 7 months ago by breun (Nils Breunese)
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
I pushed updates for openjdk21 21.0.10 and openjdk25 25.0.2 this month, which succeeded for me locally after installing the Metal toolchain, but these builds are failing on the macOS 26 buildbots, so it seems this issue is back.
openjdk21: https://build.macports.org/builders/ports-26_arm64-builder/builds/25096
checking for metal... [not found] checking if metal can be run using xcrun... no configure: error: XCode tool 'metal' neither found in path nor with xcrun configure exiting with result code 1
openjdk25: https://build.macports.org/builders/ports-26_arm64-builder/builds/25097
checking for metal... [not found] checking if metal can be run using xcrun... no configure: A full XCode is required to build the JDK (not only command line tools) configure: If you have XCode installed, you might need to reset the Xcode active developer directory configure: using 'sudo xcode-select -r' configure: error: XCode tool 'metal' neither found in path nor with xcrun configure exiting with result code 1
So, it seems like the Metal toolchain on the buildbots is no longer getting found, while it was found before and it is found for me locally on macOS 26.2 with Xcode 26.2 with the Metal toolchain set up according to the instructions at TahoeProblems#MetaltoolchainisnolongerbundledinXcode.
I'm holding off on pushing updates for other OpenJDK versions for now, because I expect those builds will also fail to access the Metal toolchain on the buildbots.
comment:4 Changed 7 months ago by markmentovai (Mark Mentovai)
On the bot, try removing the xcrun cache:
% sudo rm -f "$(sudo --user=macports getconf DARWIN_USER_TEMP_DIR)/xcrun_db"
and then retrying the build.
comment:5 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
I already did that, since it's in the aforementioned instructions.
comment:6 follow-ups: 7 8 Changed 7 months ago by markmentovai (Mark Mentovai)
Can you show the output of these commands on that bot, running as the macports user?
xcodebuild -showComponent MetalToolchain xcodebuild -find metal xcrun_verbose=1 xcrun --find metal xcrun_verbose=1 xcrun --sdk macosx --find metal xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal xcrun metal --version xcrun --sdk macosx metal --version xcrun --sdk macosx26.2 metal --version mount | grep MetalToolchain ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt ls -lT /private/var/run/com.apple.security.cryptexd/mnt
That should help figure out which step the problem is creeping in at.
(Yeah, it’s a lot, but I’m hoping to reduce the number of turnarounds.)
comment:7 Changed 7 months ago by breun (Nils Breunese)
Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot? Hopefully this lets us spot what is causing the Metal toolchain to not get found, which is causing OpenJDK builds to fail on macOS 26.
comment:8 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to markmentovai:
Can you show the output of these commands on that bot, running as the
macportsuser?
% sudo -u macports -s Password: % % whoami macports % % xcodebuild -showComponent MetalToolchain Asset Path: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData Build Version: 17C48 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.3.48.0.Nbv3Sw % % xcodebuild -find metal /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --find metal xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find metal 2> /dev/null' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved with 'xcodebuild -find' to '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal' /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --sdk macosx --find metal xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk -find metal 2> /dev/null' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved with 'xcodebuild -find' to '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal' /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx26.2 -version Path' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = 'macosx26.2' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal' /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/bin/metal % % xcrun metal --version Apple metal version 32023.850 (metalfe-32023.850.10) Target: air64-apple-darwin25.2.0 Thread model: posix InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin % % xcrun --sdk macosx metal --version Apple metal version 32023.850 (metalfe-32023.850.10) Target: air64-apple-darwin25.2.0 Thread model: posix InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin % % xcrun --sdk macosx26.2 metal --version Apple metal version 32023.850 (metalfe-32023.850.10) Target: air64-apple-darwin25.2.0 Thread model: posix InstalledDir: /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw/Metal.xctoolchain/usr/metal/current/bin % % mount | grep MetalToolchain /dev/disk7s1 on /private/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw (apfs, sealed, local, read-only, journaled, nobrowse) % % ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt drwxr-xr-x 22 root wheel 704 Nov 22 13:49:28 2025 / drwxr-xr-x 6 root wheel 192 Feb 9 19:31:10 2026 /private drwxr-xr-x 35 root wheel 1120 Jan 19 14:57:04 2026 /private/var drwxrwxr-x 32 root daemon 1024 Feb 9 19:46:12 2026 /private/var/run drwx---r-x 8 root daemon 256 Feb 9 19:31:22 2026 /private/var/run/com.apple.security.cryptexd drwxr-xr-x 3 root daemon 96 Feb 9 19:47:40 2026 /private/var/run/com.apple.security.cryptexd/mnt drwxr-xr-x 3 root daemon 96 Feb 9 19:47:40 2026 /private/var/run/com.apple.security.cryptexd/mnt % % ls -lT /private/var/run/com.apple.security.cryptexd/mnt total 0 drwxr-xr-x 4 root wheel 128 Nov 12 23:56:17 2025 com.apple.MobileAsset.MetalToolchain-v17.3.48.0.Nbv3Sw %
comment:9 follow-up: 11 Changed 7 months ago by breun (Nils Breunese)
Any idea what's wrong here, Mark?
comment:10 Changed 7 months ago by Dave-Allured (Dave Allured)
| Cc: | Dave-Allured added |
|---|
comment:11 follow-up: 12 Changed 7 months ago by markmentovai (Mark Mentovai)
Replying to breun:
Any idea what's wrong here, Mark?
Everything in comment 8 looks totally correct. I’d expect the build to succeed on that bot on the basis of what’s shown, assuming it’s running MacPorts 2.11.6 or later with the initgroups fix.
Can the build be retried? Then, only if it fails, we can repeat the investigation, in particular of the xcrun_verbose=1 xcrun --find commands?
Nils, note that the OpenJDK build has this quirk, where it finds metal by running xcrun -sdk macosx metal. The -sdk macosx circumvents the MacPorts-set SDKROOT, which may be undesirable, and results in xcrun using a different cache key than it would otherwise use. But JDK calling out -sdk macosx is why I asked for xcrun --sdk macosx --find metal above, and as you’ll see from Ryan’s response, xcrun was still able to resolve metal properly even with the SDK specified by that name. I don’t think that this is our problem, but you might still want to address it in the JDK ports regardless.
comment:12 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to markmentovai:
Can the build be retried?
Sure; they'll show up at https://build.macports.org/builders/ports-26_arm64-watcher/builds/4679 tomorrow. (Until then, that URL will show "No such resource".)
comment:13 Changed 7 months ago by breun (Nils Breunese)
Failed again sadly.
openjdk21 (https://build.macports.org/builders/ports-26_arm64-builder/builds/28552/steps/install-port/logs/stdio):
checking for metal... [not found] checking if metal can be run using xcrun... no configure: error: XCode tool 'metal' neither found in path nor with xcrun configure exiting with result code 1
openjdk25 (https://build.macports.org/builders/ports-26_arm64-builder/builds/28553/steps/install-port/logs/stdio):
checking for metal... [not found] checking if metal can be run using xcrun... no configure: A full XCode is required to build the JDK (not only command line tools) configure: If you have XCode installed, you might need to reset the Xcode active developer directory configure: using 'sudo xcode-select -r' configure: error: XCode tool 'metal' neither found in path nor with xcrun configure exiting with result code 1
qt6-qtwebengine (https://build.macports.org/builders/ports-26_arm64-builder/builds/28554/steps/install-port/logs/stdio):
error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain
Ryan, could you repeat Mark's commands on the buildbot ("repeat the investigation, in particular of the xcrun_verbose=1 xcrun --find commands")?
comment:14 follow-up: 15 Changed 7 months ago by breun (Nils Breunese)
Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot once more to check if they still return the same output?
comment:15 follow-up: 16 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to breun:
Ryan, could you run the commands Mark posted on the macOS 26 arm64 buildbot once more to check if they still return the same output?
Hmm, it's different now.
% sudo -u macports -s Password: % % whoami macports % % xcodebuild -showComponent MetalToolchain shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied Build Version: 17C48 Status: uninstalled % % xcodebuild -find metal /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --find metal xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -version PlatformPath' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform' xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find metal 2> /dev/null' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved with 'xcodebuild -find' to '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --sdk macosx --find metal xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: looking up with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk -find metal 2> /dev/null' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved with 'xcodebuild -find' to '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal % % xcrun_verbose=1 xcrun --sdk macosx26.2 --find metal xcrun: note: looking up SDK with '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx26.2 -version Path' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = 'macosx26.2' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied xcrun: note: lookup resolved to: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: database key is: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk|/Applications/Xcode.app/Contents/Developer|<manpath> xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:' xcrun: note: PATH = '/opt/bblocal/bin:/opt/bblocal/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin' xcrun: note: SDKROOT = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk' xcrun: note: TOOLCHAINS = '' xcrun: note: DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer' xcrun: note: XCODE_DEVELOPER_USR_PATH = '' xcrun: note: xcrun_db = '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' xcrun: note: xcrun via metal (xcrun) xcrun: note: database key is: metal|/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.2.sdk||/Applications/Xcode.app/Contents/Developer| xcrun: note: lookup resolved in '/var/folders/yt/6ck4znss62l7v2tk_2qsqg680000gp/T/xcrun_db' : '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal % % xcrun metal --version error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain % % xcrun --sdk macosx metal --version error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain % % xcrun --sdk macosx26.2 metal --version error: error: cannot execute tool 'metal' due to missing Metal Toolchain; use: xcodebuild -downloadComponent MetalToolchain % % mount | grep MetalToolchain % % ls -ldfT / /private /private/var /private/var/run /private/var/run/com.apple.security.cryptexd /private/var/run/com.apple.security.cryptexd/mnt /private/var/run/com.apple.security.cryptexd/mnt drwxr-xr-x 22 root wheel 704 Feb 5 05:13:23 2026 / drwxr-xr-x 6 root wheel 192 Feb 23 04:52:06 2026 /private drwxr-xr-x 35 root wheel 1120 Feb 14 03:03:39 2026 /private/var drwxrwxr-x 33 root daemon 1056 Feb 23 05:02:54 2026 /private/var/run drwx---r-x 8 root daemon 256 Feb 23 04:52:11 2026 /private/var/run/com.apple.security.cryptexd drwxr-xr-x 2 root daemon 64 Feb 23 04:52:10 2026 /private/var/run/com.apple.security.cryptexd/mnt drwxr-xr-x 2 root daemon 64 Feb 23 04:52:10 2026 /private/var/run/com.apple.security.cryptexd/mnt % % ls -lT /private/var/run/com.apple.security.cryptexd/mnt total 0 %
So the Metal toolchain has apparently uninstalled itself.
comment:16 follow-up: 17 Changed 7 months ago by markmentovai (Mark Mentovai)
Replying to ryandesign:
% ls -lT /private/var/run/com.apple.security.cryptexd/mnt total 0 %So the Metal toolchain has apparently uninstalled itself.
It’s not necessarily uninstalled, just not mounted. Usually cryptexd would mount it on demand as needed. It won’t appear mounted after a reboot. xcodebuild -showComponent MetalToolchain should have caused it to be mounted, though.
If installed, /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg should show it.
% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg -rw-r--r-- 1 _nsurlsessiond wheel 717677052 Dec 15 09:45 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData/Restore/022-20660-054.dmg -rw-r--r-- 1 _nsurlsessiond wheel 715162684 Sep 25 23:33 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg -rw-r--r-- 1 _nsurlsessiond wheel 716269972 Nov 3 20:06 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/68d8db6212b48d387d071ff7b905df796658e713.asset/AssetData/Restore/022-20369-066.dmg
022-20660-054.dmg is MetalToolchain 17C48. Does the bot have that?
The other thing I notice: the first difference between comment:8 and comment:15 is:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
Does it help to cd to a “safe” (accessible to the macports user) directory immediately after sudo -u macports -s? (Perhaps this is a red herring, because the same error does appear later on in comment:8.)
comment:17 follow-up: 23 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to markmentovai:
It’s not necessarily uninstalled, just not mounted.
I assumed it has been uninstalled because...
Replying to ryandesign:
% xcodebuild -showComponent MetalToolchain shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied Build Version: 17C48 Status: uninstalled
...it says it is uninstalled.
If installed,
/System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmgshould show it.% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg -rw-r--r-- 1 _nsurlsessiond wheel 717677052 Dec 15 09:45 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/0bc538ab0cfa107625f77ad7bcfa566abe43e917.asset/AssetData/Restore/022-20660-054.dmg -rw-r--r-- 1 _nsurlsessiond wheel 715162684 Sep 25 23:33 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/4ab058bc1c53034b8c0a9baca6fba2d2b78bb965.asset/AssetData/Restore/022-17211-415.dmg -rw-r--r-- 1 _nsurlsessiond wheel 716269972 Nov 3 20:06 /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/68d8db6212b48d387d071ff7b905df796658e713.asset/AssetData/Restore/022-20369-066.dmg
022-20660-054.dmgis MetalToolchain 17C48. Does the bot have that?
There's nothing there:
% ls -l /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg zsh: no matches found: /System/Library/AssetsV2/com_apple_MobileAsset_MetalToolchain/*/AssetData/Restore/*.dmg
The other thing I notice: the first difference between comment:8 and comment:15 is:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission deniedDoes it help to
cdto a “safe” (accessible to the macports user) directory immediately aftersudo -u macports -s? (Perhaps this is a red herring, because the same error does appear later on in comment:8.)
It doesn't seem to make a difference.
comment:18 Changed 7 months ago by markmentovai (Mark Mentovai)
Replying to ryandesign:
So weird!
If you install it again, can you do anything to monitor how long it sticks around, so we can maybe work out what’s causing it to be uninstalled?
comment:19 follow-ups: 20 21 Changed 7 months ago by axonde (Axonde ✦)
I'm experiencing a similar issue on my local machine (macOS 15.0, Xcode 16.0), Metal toolchain installed via MobileAsset, path:
/var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-.../Metal.xctoolchain/usr/bin/metal
The configure script for openjdk25 fails with:
checking for metal... [not found] checking if metal can be run using xcrun... no configure: error: XCode tool 'metal' neither found in path nor with xcrun
However, xcrun itself locates the tool correctly:
% xcrun --sdk macosx --find metal /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-v17.3.519.0.4VzvkH/Metal.xctoolchain/usr/bin/metal % xcrun --sdk macosx metal --version Apple metal version 32023.850 (metalfe-32023.850.10) ...
It seems that during configuration, the check for metal either doesn't use xcrun correctly or the xcrun cache is not properly updated for the specific SDK used by the configure script.
Workaround that worked for me:
I created a symbolic link to metal in a directory already present in PATH (specifically /opt/local/bin):
sudo ln -s /var/run/com.apple.security.cryptexd/mnt/com.apple.MobileAsset.MetalToolchain-*/Metal.xctoolchain/usr/bin/metal /opt/local/bin/metal
After that, the configure step succeeded and the port built without issues.
This suggests that adding the ability to respect a METAL environment variable (like for CC, CXX) or improving the xcrun invocation in the configure script might help. Alternatively, ensuring that the xcrun cache is refreshed or that the path is added to PATH during configuration could also resolve it.
Hope this additional data helps in fixing the issue for both buildbots and end users.
comment:20 Changed 7 months ago by breun (Nils Breunese)
Replying to axonde:
Workaround that worked for me
Did you try the workaround documented on the wiki first?
comment:21 follow-up: 22 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | axonde added |
|---|
Replying to axonde:
The configure script for openjdk25 fails with:
checking for metal... [not found] checking if metal can be run using xcrun... no configure: error: XCode tool 'metal' neither found in path nor with xcrun
What does the config.log say about why this failed?
See also the preceding comment from Nils.
comment:22 Changed 7 months ago by axonde (Axonde ✦)
Replying to breun and ryandesign:
Thanks for the pointers!
To answer your questions:
Did I try the wiki workaround first?
No, I didn't – I jumped straight to creating a symlink because xcrun already found the tool, and I assumed the configure script would respect that. I should have checked the wiki first.
What does config.log say?
I've now removed my symlink and followed the official workaround from TahoeProblems. After that, both openjdk21 and openjdk25 configured and built successfully without any errors. Since the build now works, the relevant config.log no longer shows the failure. If you'd like me to attach the original failing config.log (from before the fix) for reference, I can do that – just let me know.
So the wiki instructions are definitely correct and sufficient for a local setup like mine!
comment:23 follow-up: 26 Changed 6 months ago by breun (Nils Breunese)
Replying to ryandesign:
Could you try to install the Metal toolchain on the macOS 26 buildbot once more, and then try a build of openjdk25? And if it fails again, could you check whether the Metal toolchain is still installed after it failed?
Is there maybe someone who we could ask to assist with getting and keeping the Metaltoolchain installed on the macOS 26 buildbot? This issue is blocking builds of several ports now.
comment:24 follow-up: 25 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
If the Metal toolchain is going to uninstall itself and need installation regularly, buildbot or MacPorts ought to do it automatically.
comment:25 follow-up: 41 Changed 6 months ago by breun (Nils Breunese)
Replying to ryandesign:
If the Metal toolchain is going to uninstall itself and need installation regularly, buildbot or MacPorts ought to do it automatically.
Would it make sense to modify MacPorts so that a Portfile can specify something like use_metal yes, so MacPorts can make sure the Metal toolchain is available before trying to build a port that has this flag set?
comment:26 follow-up: 27 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to breun:
Could you try to install the Metal toolchain on the macOS 26 buildbot once more, and then try a build of
openjdk25?
I've reinstalled the Metal toolchain and queued up another build of openjdk25.
comment:27 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to ryandesign:
another build of openjdk25.
It succeeded so I've queued builds for openjdk21 and qt6-qtwebengine too.
comment:28 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
qt6-qtwebengine succeeded (despite the exception shown there).
comment:30 Changed 6 months ago by breun (Nils Breunese)
That's great!
I tried building openjdk17 on CI after bumping it to 17.0.18, but that still failed. I guess this is due to the Metal toolchain not (correctly?) installed on the macOS 26 GitHub CI instances?
comment:31 follow-up: 32 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
I have no knowledge of the Metal situation on GitHub Actions runners.
comment:32 Changed 6 months ago by breun (Nils Breunese)
Replying to ryandesign:
I have no knowledge of the Metal situation on GitHub Actions runners.
Would you recommend just pushing the update to master then, when it builds on my machine when the Metal toolchain is installed, or do you know someone who knows about the GitHub Actions runners?
comment:33 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
GitHub documents what software is provided on their runner images if you want to check that, but it seems evident that they are not including the Metal toolchain on their macOS Tahoe runner. Maybe they should be. It looks like they intend to. See https://github.com/actions/runner-images/issues/13014.
comment:34 Changed 6 months ago by breun (Nils Breunese)
Thanks for the pointer.
I'll push to master after local verification for now, and hope the buildbots still have a working Metal toolchain.
comment:35 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
I redid the Metal toolchain installation after upgrading the machine to macOS 26.4 and Xcode 26.4 recently.
Now I've upgraded it to macOS 26.4.1 and verified that it wiped out the toolchain so I'm redoing the installation again.
comment:36 follow-ups: 37 38 Changed 5 months ago by Dave-Allured (Dave Allured)
Updates. GitHub says that the Metal toolchain is now confirmed to be available on macOS 26 runners. The preceding message also suggests that a user's CI environment script may be causing Metal to become not available.
Also there is a new April 22 release of the macos-26-arm64 runner.
Meanwhile, recent MacPorts CI runs are still failing on macos-26, because of missing Metal Toolchain.
If MacPorts has any control over CI runner versions, then I suggest update to latest version, retry, and check for possible problems in MacPorts CI setup.
comment:37 Changed 5 months ago by Dave-Allured (Dave Allured)
update to latest version
Never mind about that. The very top of the CI log confirms that the latest runner version is already in use.
Runner Image Image: macos-26-arm64 Version: 20260422.0012.1
comment:38 Changed 5 months ago by breun (Nils Breunese)
Replying to Dave-Allured:
Meanwhile, recent MacPorts CI runs are still failing on macos-26, because of missing Metal Toolchain.
The recent OpenJDK update builds succeeded on the macOS 26 buildbot (11.0.31, 17.0.19, 21.0.11, 25.0.3), so the Metal toolchain was available for those builds.
comment:39 Changed 5 months ago by Dave-Allured (Dave Allured)
Nice! I suppose this was due to Ryan's Metal installation of April 10 (above)? I am hoping for permanent fixes on both Github runners and MacPorts builders, without manual intervention.
comment:40 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
So far, it looks like the permanent fix will be for me to reinstall the Metal toolchain everytime I update macOS 26 on a buildbot worker.
comment:41 Changed 5 months ago by breun (Nils Breunese)
Ryan, any thoughts on this idea I posted a while ago?
Would it make sense to modify MacPorts so that a Portfile can specify something like
use_metal yes, so MacPorts can make sure the Metal toolchain is available before trying to build a port that has this flag set?
Do you think that would be feasible, and if so, a good idea? That would not only mean you don’t need to restore the toolchain on every OS update, but it would also help MacPorts users that build ports from source which require the Metal toolchain.
comment:42 Changed 5 months ago by ryandesign (Ryan Carsten Schmidt)
If you mean that use_metal yes would automatically install the Metal toolchain, then I don't think we should do that. For one thing, it would be similar to automatically installing Xcode for use_xcode yes, or automatically installing the command line tools, which we also don't do. For another, the Metal toolchain installation instructions include the step of restarting the computer.
If you mean that use_metal yes would check if the Metal toolchain is installed and print an error if it isn't, just like use_xcode yes prints an error if Xcode is not installed, then yes, that could be done.
comment:43 follow-ups: 46 47 Changed 5 months ago by breun (Nils Breunese)
I've never had to reboot to get the Metal toolchain to work myself, but it's in the instructions as something to try, because in at least one case it did solve somebody's problem with using Metal.
I think the logic for use_metal yes could look something like this:
- Check for Xcode and fail it isn't installed. (Basically let
use_metal yesimplyuse_xcode yes?) - Check if the Metal toolchain is set up correctly for use by MacPorts. If so, we're good and done.
- Set up the Metal toolchain component according to the instructions on the MacPorts wiki (no reboot).
- Check again if the Metal toolchain is set up correctly for use by MacPorts. If so, we're good and done.
- Fail and tell the user that the build requires the Metal toolchain, but that setting it up failed and that a reboot may fix this (with a link to the Metal toolchain wiki entry?).
If letting MacPorts attempt to set up the Metal toolchain automatically is not considered acceptable and users (and the buildbot maintainers 😉) should always set up the Metal toolchain manually themselves, then we'd have to drop steps 3 and 4, but the actionable error message would still be an improvement over the current situation.
comment:44 Changed 5 months ago by Dave-Allured (Dave Allured)
My very recent testing confirms that that Metal Toolchain is now installed on GitHub macOS 26 runners (CI) on startup.
Also I am coming around to agree with Ryan, that Metal Toolchain must be manually reinstalled on every macOS 26 update on buildbots. It would be nice to have a way to do this automatically, or even better on demand. But right now, there does not seem to be any way to do either.
Given these two, I think the only remaining need is for better messaging to direct users to self-install Metal Toolchain, as needed for Metal-dependent ports. I doubt that there is a need for use_metal yes proposed by Nils, because the failed logs that I have seen recently, have fairly clear messaging that Metal is missing.
comment:45 Changed 5 months ago by breun (Nils Breunese)
The error message is in the log, but it doesn’t direct a user to TahoeProblems#MetaltoolchainisnolongerbundledinXcode and without those instructions, the user is unlikely to end up with a Metal toolchain setup that actually works for MacPorts.
comment:46 Changed 5 months ago by breun (Nils Breunese)
Replying to breun:
If letting MacPorts attempt to set up the Metal toolchain automatically is not considered acceptable and users (and the buildbot maintainers 😉) should always set up the Metal toolchain manually themselves, then we'd have to drop steps 3 and 4, but the actionable error message would still be an improvement over the current situation.
Instead of either erroring out or setting up Metal automatically MacPorts could also offer to set it up and let the user decide? If they don’t want MacPorts to do that, MacPorts could skip the port that requires it and continue with the next, instead of aborting the whole execution with an error. Of course, this would only be a possibility for interactive runs.
comment:47 follow-up: 48 Changed 5 months ago by markmentovai (Mark Mentovai)
Replying to breun:
I've never had to reboot to get the Metal toolchain to work myself, but it's in the instructions as something to try, because in at least one case it did solve somebody's problem with using Metal.
Correct: strictly speaking, a reboot shouldn’t be necessary in most cases. It can help in some specific situations:
- If a bad path to
metalormetallibhas been stored inxcrun_db, a reboot will help, because it results in the removal ofxcrun_db(in the “T” temporary directory). This can be achieved without a reboot by running, as the macports user,rm -f "$(getconf DARWIN_USER_TEMP_DIR)/xcrun_db". - If another user has mounted the Metal .dmg in a private location, a reboot will help, because the Metal .dmg will not be mounted at all in a freshly booted system. This can be achieved without a reboot by running, as root,
diskutil eject $(xcodebuild -showComponent MetalToolchain | sed -E -n -e 's/^Toolchain Search Path: (.*)$/\1/p').
I think the logic for
use_metal yescould look something like this:
- Check for Xcode and fail it isn't installed. (Basically let
use_metal yesimplyuse_xcode yes?)- Check if the Metal toolchain is set up correctly for use by MacPorts. If so, we're good and done.
- Set up the Metal toolchain component according to the instructions on the MacPorts wiki (no reboot).
- Check again if the Metal toolchain is set up correctly for use by MacPorts. If so, we're good and done.
- Fail and tell the user that the build requires the Metal toolchain, but that setting it up failed and that a reboot may fix this (with a link to the Metal toolchain wiki entry?).
I suggest adding a removal of xcrun_db before any Metal check. It still seems to be very easy for bad paths to be cached in that file. Removing it is simple insurance against such problems. So my suggestion for steps 2 and 4 are:
rm -f "$(getconf DARWIN_USER_TEMP_DIR)/xcrun_db" && xcrun metal --version
If xcrun metal --version exits with status 0, “we’re good and done”.
(I would not suggest attempting the unmount, because that could have undesirable side effects, and it addresses a condition that happens much less frequently, and ideally never at all on MacPorts buildbots.)
If letting MacPorts attempt to set up the Metal toolchain automatically is not considered acceptable and users (and the buildbot maintainers 😉) should always set up the Metal toolchain manually themselves, then we'd have to drop steps 3 and 4, but the actionable error message would still be an improvement over the current situation.
Replying to Dave-Allured:
I doubt that there is a need for
use_metal yesproposed by Nils, because the failed logs that I have seen recently, have fairly clear messaging that Metal is missing.
This is entirely under the control of the port’s own build. In the case of the case of the openjdk builds, I think that the most actionable message, which still isn’t as actionable as it could be, is buried a level further than ideal: main.log refers the user to the port-controlled config.log.
comment:48 Changed 5 months ago by Dave-Allured (Dave Allured)
Replying to markmentovai:
If
xcrun metal --versionexits with status 0, “we’re good and done”.
I am experimenting with this, but I need some help with Portfile coding. How do I do these things:
- Run this command near the start of a build?
- Print its stdout/stderr into the build log?
- Test that status result?
- Abort the build with error status?
I tried simply this, with no useful output or error message displayed:
configure.cmd xcrun metal -v
comment:49 Changed 7 weeks ago by breun (Nils Breunese)
It looks like the macOS buildbots are missing the Metal toolchain again. The OpenJDK updates I pushed yesterday fail again. Example: https://build.macports.org/builders/ports-26_arm64-builder/builds/40158
Ryan, could you get the Metal toolchain installed again and trigger builds for openjdk11, openjdk17, openjdk21, openjdk25 and openjdk26 afterwards?
comment:50 Changed 7 weeks ago by EvilJordan (Jordan Holberg)
| Cc: | EvilJordan added |
|---|
comment:51 follow-up: 52 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)
On July 3 I updated that buildbot worker's macOS to 26.5.2 and Xcode and CLT to 26.6. I do not recall whether I reinstalled the Metal toolchain after that, however xcrun metal -v shows that it is installed and exits with status 0.
Today I updated its macOS to 26.6, after which xcrun metal -v shows an error that the Metal toolchain is not installed and exits with status 1. After reinstalling the Metal toolchain per the wiki page, the version that is now installed appears to be the same as before.
I would like to add a check to the buildbot worker startup script so that it does not start if the Metal toolchain is not satisfactorily installed, so that this problem can be detected earlier, if someone can tell me what command would determine that, since xcrun metal -v evidently isn't sufficient.
Builds of the openjdk's are queued.
comment:52 follow-up: 54 Changed 6 weeks ago by breun (Nils Breunese)
Replying to ryandesign:
I would like to add a check to the buildbot worker startup script so that it does not start if the Metal toolchain is not satisfactorily installed, so that this problem can be detected earlier, if someone can tell me what command would determine that, since
xcrun metal -vevidently isn't sufficient.
From your comment it seems like that command is actually sufficient, because it returned 0 when it was ok and 1 when it wasn’t, right?
comment:53 Changed 6 weeks ago by breun (Nils Breunese)
I believe the real test is whether ${macportsuser} can successfully run xcrun metal --version, because there have been cases of regular users being able to run that successfully, but the same command failing when run as ${macportsuser}. I was just working on https://github.com/macports/macports-ports/pull/32889 today to improve the error messages for ports that require the Metal toolchain, which also uses this test.
comment:54 follow-up: 55 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)
Replying to breun:
Replying to ryandesign:
I would like to add a check to the buildbot worker startup script so that it does not start if the Metal toolchain is not satisfactorily installed, so that this problem can be detected earlier, if someone can tell me what command would determine that, since
xcrun metal -vevidently isn't sufficient.From your comment it seems like that command is actually sufficient, because it returned 0 when it was ok and 1 when it wasn’t, right?
See my first paragraph. Prior to updating to 26.6, xcrun was not returning an error, but you posted a build log above where the build nevertheless failed.
comment:55 follow-up: 59 Changed 6 weeks ago by breun (Nils Breunese)
Replying to ryandesign:
See my first paragraph. Prior to updating to 26.6, xcrun was not returning an error, but you posted a build log above where the build nevertheless failed.
Did you run xcrun as the macports user in that case?
comment:56 follow-up: 57 Changed 6 weeks ago by markmentovai (Mark Mentovai)
Per comment:11, SDKROOT is also relevant to xcrun metal --version’s behavior. Nils, did you patch the openjdk ports to not use xcrun -sdk macosx metal as we discussed at pull 32889?
comment:57 follow-up: 58 Changed 6 weeks ago by breun (Nils Breunese)
Replying to markmentovai:
Per comment:11,
SDKROOTis also relevant toxcrun metal --version’s behavior. Nils, did you patch the openjdk ports to not use xcrun -sdk macosx metal as we discussed at pull 32889?
That patch is part of https://github.com/macports/macports-ports/pull/32889, which I think is now ready to merge. Once this is merged for openjdk25, I plan to spread these improvements to the other OpenJDK ports.
comment:58 Changed 6 weeks ago by markmentovai (Mark Mentovai)
Replying to breun:
Replying to markmentovai:
Per comment:11,
SDKROOTis also relevant toxcrun metal --version’s behavior. Nils, did you patch the openjdk ports to not use xcrun -sdk macosx metal as we discussed at pull 32889?That patch is part of https://github.com/macports/macports-ports/pull/32889, which I think is now ready to merge. Once this is merged for
openjdk25, I plan to spread these improvements to the other OpenJDK ports.
Great.
Not having that patch in place is the likely reason for ryandesign’s:
Prior to updating to 26.6, xcrun was not returning an error, but you posted a build log above where the build nevertheless failed.
comment:59 Changed 6 weeks ago by ryandesign (Ryan Carsten Schmidt)
Replying to breun:
Did you run
xcrunas themacportsuser in that case?
No, I've always run it as the normal logged in administrative user.

https://build.macports.org/builders/ports-26_arm64-watcher/builds/1621