orca-app / orca

A Wasm environment for cross-platform, sandboxed graphical applications.
https://orca-app.dev
Other
156 stars 13 forks source link

Add notes on possible additional xcode setup for mac users #48

Open memco opened 8 months ago

memco commented 8 months ago

When trying to install Orca on mac this message appeared: "xcrun: error: unable to find utility "metal", not a developer tool or in PATH" The instructions as explained here solve the issue: https://github.com/gfx-rs/gfx/issues/2309#issuecomment-506130902

martinfouilleul commented 8 months ago

I was a little confused at first by what the switch command does (the last sentence can sound like the command makes sure Xcode.app is installed). I would maybe reword it in a more verbose/explicit way, eg:

- Mac Only: both the Xcode app and the Xcode command-line tools must be installed:  
    - Make sure the Xcode app is installed, or install it from the app store.
    - The command line tools can be installed with `xcode-select --install`.
         - If xcode-select --print-path prints /Library/Developer/CommandLineTools, then run `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer`

Is that correct? If so I can make that change myself when I'm back at my work computer, or you can do it and I'll merge it. Anyway thanks for the PR!

bvisness commented 8 months ago

I'm confused by this because I'm pretty sure I have not installed full Xcode on my Mac, and yet have had no trouble running these utilities. Can we confirm what version of Mac you (the OP) are using and which Xcode-related utilities are installed when you don't download the full app?

memco commented 8 months ago

As for system info, I have an M2 macbook air running MacOS 14.1.1 (23B81)

λ xcode-select --version
xcode-select version 2403.
λ xcodebuild -version                                                                                            
Xcode 15.0.1
Build version 15A507

I do not believe I had run xcode-select or installed xcode since updating to 14, but I am fairly sure I had at least run xcode-select on prior versions of MacOS.

I started with just trying to run xcode-select --install but that didn't solve the issue. I still had this error:

~/.pyenv/versions/3.10.7/bin/python orca dev build-runtime
Building Orca platform layer...
xcrun: error: unable to find utility "metal", not a developer tool or in PATH
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

Task failed with 1 error:
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

My search for that error led to the fix I linked in the PR description.

I have tried uninstalling both xcode and the xcode cli tools from and tried just reinstalling via xcode-select --install, but the above error returns. I then reinstalled xcode and tested both paths:

(*main) λ /Users/michael/.pyenv/versions/3.12.0/bin/python orca dev build-runtime
Building Orca platform layer...
xcrun: error: unable to find utility "metal", not a developer tool or in PATH
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

Task failed with 1 error:
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal
(*main) λ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
(*main) λ /Users/michael/.pyenv/versions/3.12.0/bin/python orca dev build-runtime
Building Orca platform layer...
Building wasm3...
Building Orca runtime...
Task completed successfully.
sudo xcode-select --switch /Library/Developer/CommandLineTools
Password:
(*main) λ /Users/michael/.pyenv/versions/3.12.0/bin/python orca dev build-runtime
Building Orca platform layer...
xcrun: error: unable to find utility "metal", not a developer tool or in PATH
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

Task failed with 1 error:
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

Using the xcode-select --switch ... is only needed if the xcrun command fails to find metal so maybe it would be better to put this note in the after the python orca dev build-runtime instruction:

Install the Orca dev tools. If on Windows, the tool can automatically add orca to your PATH. Otherwise, you must manually add the Orca install directory to your PATH, e.g. by updating .zshrc or .bashrc.

If on MacOS the above command fails with the error:

xcrun: error: unable to find utility "metal", not a developer tool or in PATH
ERROR: The following command failed with code 72:
xcrun -sdk macosx metal -fno-fast-math -c -o build/mtl_renderer.air src/graphics/mtl_renderer.metal

And xcode-select --print-path prints /Library/Developer/CommandLineTools Install the full xcode Application from the App Store and then run sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer