gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
92 stars 8 forks source link

Allow running native builds on macOS without xcode installed #908

Open ThadHouse opened 5 years ago

ThadHouse commented 5 years ago

We have a GCC cross compiler that works without xcode on macOS. Our build should handle a compiler not being installed, and print an error message. This works on windows and linux by disabling the specific platform build if the compiler was not found. However, on macOS the build fails without xcode before we can get to the point of disabling them from our end.

I'm working on reinstalling to remove xcode to get a full stacktrace and a build scan, but here is the printed out error message.

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting
 install. Choose an option in the dialog to download the command line developer tools.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'GRMacTest'.
> Exception thrown while executing model rule: NativeBinaryRules#assignTools(NativeBinarySpec, NativeToolChainRegistryInternal, ProjectLayout)
   > Process 'command 'xcrun'' finished with non-zero exit value 1

This is on a macOS High Sierra system with Gradle 4.9. I'll try and get a full stack trace tonight, but this should be fairly easy to track without that.

Steps to Reproduce (for bugs)

Have a build with a custom toolchain. We have a build setup to test if you want. GRMacTest.zip

If you run build with this, it will fail to build because it can't find our toolchain, but with this issue it won't even get that far.