Closed Bug 1586291 Opened 5 years ago Closed 5 years ago

Missing XCode command line tools for Metal SDK

Categories

(Firefox Build System :: General, enhancement, P3)

x86_64
macOS
enhancement

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: kvark, Unassigned)

References

Details

I'm trying to add a dependency that needs to build some Metal shaders in build.rs. The try fails because something can't be found:

k 2019-10-04T03:19:12.531Z] 03:19:12 INFO - Running /builds/worker/workspace/build/src/obj-firefox/debug/build/gfx-backend-metal-77f6aa08cd9153c4/build-script-build
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - [num-integer 0.1.39] cargo:rustc-cfg=has_i128
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - Fresh memchr v2.2.0
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - [gfx-backend-metal 0.3.2] cargo:rerun-if-changed=/builds/worker/workspace/build/src/third_party/rust/gfx-backend-metal/shaders
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - [gfx-backend-metal 0.3.2] cargo:rerun-if-changed=/builds/worker/workspace/build/src/third_party/rust/gfx-backend-metal/shaders/blit.metal
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - [gfx-backend-metal 0.3.2] thread 'main' panicked at 'failed to execute metal compiler: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:999:5
[task 2019-10-04T03:19:12.532Z] 03:19:12 INFO - [gfx-backend-metal 0.3.2] stack backtrace:

That "something" is xcrun, I believe, which is a part of XCode command line tools. Is there a way for us to enable/install them on Try instances?

Blocks: 1575008
Component: Try → General
Priority: -- → P3

Our automation builds are running on a Linux host, cross compiling to macOS, so we probably need to change our approach here. Instead of checking for the path to the metal compiler with xcrun we should probably make it a check in configure and pass it directly. We also need to check that the sdk being used for mac builds is recent enough to include the tool (it looks like 10.11, currently).

Chris,

Could you clarify the proposed idea, please? The "we should probably make it a check in configure and pass it directly" bit piece is not clear to me, since we get the error in build.rs, which comes with no "configure" script. Perhaps we should change our build.rs to take the path from an environment variable that Gecko build system provides?

We also need to check that the sdk being used for mac builds is recent enough to include the tool (it looks like 10.11, currently).

According to the wiki, 10.11 should have the tools. Is there a way for us to verify that xcrun and metal compiler are there?

Flags: needinfo?(cmanchester)

I believe the issue is that xcrun isn't available on a linux host. So the idea would be to find metal in our configure script based on the sdk's location, and communicate that to build.rs (I think an environment variable or file to include/read). I think bindgen does something similar, the approach there may be instructive.

Flags: needinfo?(cmanchester)

xcrun is not the only thing that is being executed. It's merely a wrapper. What is actually executed is metal and metallib... and those won't work either on a Linux host...

Ok, so what's the plan? We can't use Linux cross-compiling any more and have to switch to OSX host compilation?

(In reply to Dzmitry Malyshau [:kvark] from comment #5)

Ok, so what's the plan? We can't use Linux cross-compiling any more and have to switch to OSX host compilation?

This would be an enormous ask of releng/relops, although it's not my call to make.

Would it be feasible to run the build.rs on a mac before the build and upload its result as a dependency of the actual build?

Yes, looks like we don't have a choice but to do this...
Please feel free to close the issue or use it for tracking if a decision to do native osx compilation is made.

Ok, will close for now.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.