Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing instructions for macOS Metal #2472

Closed
Walther opened this issue Nov 14, 2018 · 6 comments
Closed

Missing instructions for macOS Metal #2472

Walther opened this issue Nov 14, 2018 · 6 comments

Comments

@Walther
Copy link
Contributor

Walther commented Nov 14, 2018

The instructions for getting started with gfx-rs on macOS are lacking.

The Readme instructs:

# macOS
cargo run --bin quad --features metal

These examples assume that necessary dependencies for the graphics backend are already installed. For more information about installation and usage, refer to the Getting Started guide.

The Getting Started guide only has instructions for Fedora and Ubuntu.

With the instructions provided, running on macOS 10.14.1 (18B75), with only the XCode command-line utils installed (not the full XCode IDE and everything), you bump into the following error:

cargo run --bin quad --features metal
   Compiling gfx-backend-metal v0.1.0 (file:///Users/walther/git/gfx/src/backend/metal)
   Compiling spirv_cross v0.11.2
   Compiling objc_id v0.1.1
   Compiling cocoa v0.18.1
   Compiling cocoa v0.17.0
   Compiling parking_lot_core v0.3.1
   Compiling glsl-to-spirv v0.1.7
   Compiling gfx-hal v0.1.0 (file:///Users/walther/git/gfx/src/hal)
   Compiling jpeg-decoder v0.1.15
error: failed to run custom build command for `gfx-backend-metal v0.1.0 (file:///Users/walther/git/gfx/src/backend/metal)`
process didn't exit successfully: `/Users/walther/git/gfx/target/debug/build/gfx-backend-metal-eca86b15efa6c9d1/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=/Users/walther/git/gfx/src/backend/metal/shaders
cargo:rerun-if-changed=/Users/walther/git/gfx/src/backend/metal/shaders/blit.metal

--- stderr
xcrun: error: unable to find utility "metal", not a developer tool or in PATH
thread 'main' panicked at 'shader compilation failed', src/backend/metal/build.rs:68:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
^C

After a quick googling, this seems to suggest that the relevant tools might be only available after installing the full XCode distribution.

(I'll report back when I get to a place with proper internet again so that I can download the full XCode, and see if that solves the issue. If it does, I'll gladly write a PR with the step-by-step instructions ❤️ )

@Walther
Copy link
Contributor Author

Walther commented Nov 14, 2018

Confirmed, after installing the full XCode from the mac AppStore, the example runs just fine.

I wonder if there would be any other way to make this runnable? Any lightweight options of installing only the metal support somehow?

Or should I just add the instructions on the Getting started doc for installing the full XCode app?

bors bot added a commit that referenced this issue Nov 14, 2018
2473: Improve Getting Started: macOS instructions r=kvark a=Walther

Fixes #2472


Co-authored-by: Veeti Haapsamo <veeti.haapsamo@gmail.com>
@bors bors bot closed this as completed in #2473 Nov 14, 2018
@boredstiff
Copy link

In case it helps anyone in the future, I already did have XCode installed, but it still wasn't finding metal, so running sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer got it running for me again. Thanks for fixing stuff up @Walther it helped me figure out my issue pretty quickly.

@ikamensh
Copy link

would be great to emit a human readable message with those instructions so that people don't have to search the internet!

@kvark
Copy link
Member

kvark commented Mar 13, 2020

@ikamensh yes, we could do something like that in the build.rs script if we detect things to fail. Would you want to make that change?

@ikamensh
Copy link

I haven't contributed to gfx so far, so I don't know anything about the code base. Could you lay out a design idea, what conditions do I need to capture, etc. and few links to relevant places in code?

@kvark
Copy link
Member

kvark commented Mar 13, 2020

@ikamensh actually, this particular problem shouldn't exist as of #3047

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants