C++ tutorial stage1 failing on MacOs.

397 views
Skip to first unread message

Vlad Radulescu

unread,
Oct 2, 2023, 5:50:08 PM10/2/23
to bazel-discuss
Hello,

New to Bazel, trying to get the hang of it. I try running the tutorial, but when I run it I get: 



vlarad@MacBook-Air-Vlad stage1 % bazel build //main:hello-world                                
INFO: Analyzed target //main:hello-world (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/vlarad/play/examples/cpp-tutorial/stage1/main/BUILD:3:10: Compiling main/hello-world.cc failed: I/O exception during sandboxed execution: xcrun failed with code 1.
This most likely indicates that SDK version [10.11] for platform [MacOSX] is unsupported for the target version of xcode.
Process exited with status 1
stdout: stderr: 2023-10-03 00:43:29.229 xcodebuild[15215:388771] Writing error result bundle to /var/folders/wk/f4c2f1ys0cg527vsrpmjlxx40000gn/T/ResultBundle_2023-03-10_00-43-0029.xcresult
xcodebuild: error: SDK "macosx10.11" cannot be located.
2023-10-03 00:43:30.769 xcodebuild[15218:388810] Writing error result bundle to /var/folders/wk/f4c2f1ys0cg527vsrpmjlxx40000gn/T/ResultBundle_2023-03-10_00-43-0030.xcresult
xcodebuild: error: SDK "macosx10.11" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.11'
Target //main:hello-world failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.459s, Critical Path: 4.34s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Now, I'm curious what is going on that I pointed apparently bazel to the xcode compiler? I suspect that load("@rules_cc//cc:defs.bzl", "cc_binary") is doing _a lot_ of work in the background. 

 Note, I'm on MacOs Sonoma 14.0 and I do have installed xcode, as far as I can tell. 

Best,
Vlad R. 

Vlad Radulescu

unread,
Oct 2, 2023, 6:03:29 PM10/2/23
to bazel-discuss
Ok, so, figured it out. 

Ran:

xcodebuild -showsdks

and there I saw the SDK version, it's 14.0 (duuuh!)

and then I ran 

bazel build -c opt --macos_sdk_version=14.0 //main:hello-world

and then it built. 

Will admit, the invocation is kind of arcane. 

Vlad Radulescu

unread,
Oct 3, 2023, 3:01:03 AM10/3/23
to bazel-discuss

And what's more interesting is that the build works just fine on stage2 tutorial, _without_ requiring me to specify the sdk version. Anyone any idea what is going on there? On stage1 it only works with specifying it. 
Reply all
Reply to author
Forward
0 new messages