cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.75k stars 3.75k forks source link

make bazel-generate fails with SDK "macosx10.10" not found #65739

Open rimadeodhar opened 3 years ago

rimadeodhar commented 3 years ago

Describe the problem

Attempting to run make bazel-generate on my local machine in cockroach db repo gives me the following error:

❯ make bazel-generate                       
Running make with -j16
GOPATH set to /Users/rdeodhar/go
Generating DEPS.bzl and BUILD files using gazelle
./build/bazelutil/bazel-generate.sh
+ bazel run //:gazelle -- update-repos -from_file=go.mod -build_file_proto_mode=disable_global -to_macro=DEPS.bzl%go_deps -prune=true
INFO: Analyzed target //:gazelle (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_rdeodhar/f197d99d35a2d2b750c673163a6563b7/external/com_github_pmezard_go_difflib/difflib/BUILD.bazel:3:11: GoCompilePkg external/com_github_pmezard_go_difflib/difflib/difflib.a [for host] failed: I/O exception during sandboxed execution: xcrun failed with code 1.
This most likely indicates that SDK version [10.10] for platform [MacOSX] is unsupported for the target version of xcode.
Process exited with status 1
stdout: stderr: xcodebuild: error: SDK "macosx10.10" cannot be located.
xcodebuild: error: SDK "macosx10.10" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'macosx10.10'
Target //:gazelle failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.634s, Critical Path: 1.45s
INFO: 15 processes: 15 internal.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
make: *** [Makefile:1816: bazel-generate] Error 1

Running bazel build also gives me the same error.

xcodebuild --show-sdks gives me this list:

❯ xcodebuild -showsdks                                               
iOS SDKs:
        iOS 14.5                        -sdk iphoneos14.5

iOS Simulator SDKs:
        Simulator - iOS 14.5            -sdk iphonesimulator14.5

macOS SDKs:
        DriverKit 20.4                  -sdk driverkit.macosx20.4
        macOS 11.3                      -sdk macosx11.3

tvOS SDKs:
        tvOS 14.5                       -sdk appletvos14.5

tvOS Simulator SDKs:
        Simulator - tvOS 14.5           -sdk appletvsimulator14.5

watchOS SDKs:
        watchOS 7.4                     -sdk watchos7.4

watchOS Simulator SDKs:
        Simulator - watchOS 7.4         -sdk watchsimulator7.4

I can work around this issue by passing the argument -c opt --macos_sdk_version=11.3 for bazel build. For e.g., bazel build works when I run the following command and pass in the macOS SDK version explicitly:

bazel build -c opt --macos_sdk_version=11.3 pkg/cmd/cockroach-short

I don't have a workaround for make bazel-generate.

See slack thread for more context.

To Reproduce Encountered this error on GH CI for my PR: https://github.com/cockroachdb/cockroach/pull/65683. Attempting to run make bazel-generate on my local dev machine gave me the above error.

Expected behavior make bazel-generate and bazel build should work with the new SDK version.

Epic CRDB-17171 Jira issue: CRDB-7739

rickystewart commented 3 years ago

I'm not sure what the exact shape of the overall problem here is, but you can fix this by adding the following to your .bazelrc.user:

build --macos_sdk_version=11.3
mgartner commented 2 years ago

I'm hitting this too.

xcodebuild -showsdks
DriverKit SDKs:
        DriverKit 21.0.1                -sdk driverkit21.0.1

iOS SDKs:
        iOS 15.0                        -sdk iphoneos15.0

iOS Simulator SDKs:
        Simulator - iOS 15.0            -sdk iphonesimulator15.0

macOS SDKs:
        macOS 12.0                      -sdk macosx12.0

tvOS SDKs:
        tvOS 15.0                       -sdk appletvos15.0

tvOS Simulator SDKs:
        Simulator - tvOS 15.0           -sdk appletvsimulator15.0

watchOS SDKs:
        watchOS 8.0                     -sdk watchos8.0

watchOS Simulator SDKs:
        Simulator - watchOS 8.0         -sdk watchsimulator8.0

Adding build --macos_sdk_version=12.0 to my $GOPATH/go/src/github.com/cockroachdb/cockroach/.bazelrc.user file fixed the issue.

pav-kv commented 2 years ago

I get the same error when running ./dev doctor on a freshly provisioned Mac. The suggested fix helps.

knz commented 1 year ago

FYI on the latest Monterey I need build --macos_sdk_version=12.3.

github-actions[bot] commented 3 months ago

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!