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

Make Bazel clearly communicate issues with XCode install #25728

Open
eugeneo opened this issue Mar 28, 2025 · 8 comments
Open

Make Bazel clearly communicate issues with XCode install #25728

eugeneo opened this issue Mar 28, 2025 · 8 comments
Labels
P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple

Comments

@eugeneo
Copy link

eugeneo commented Mar 28, 2025

I updated the OS but did not update XCode. Bazel was failing with the most cryptic error (see below).

Please make Bazel messaging more helpful, possibly suggesting the user to check XCode install and do bazel clean --expunge

Description of the bug:

Unable to build my branch on my local macOS environment. This branch builds on CI, including Mac.

FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ActionLookupData0{actionLookupKey=ConfiguredTargetKey{label=//test/core/event_engine:common_closures_test_TEST_LIBRARY, config=BuildConfigurationKey[e7d0355b3d90789b06a9207238e0040e8b8404e05a204aa41ab02c9d9ba36c03]}, actionIndex=0}' (requested by nodes 'TargetCompletionKey{topLevelArtifactContext=com.google.devtools.build.lib.analysis.TopLevelArtifactContext@90904c3b, actionLookupKey=ConfiguredTargetKey{label=//test/core/event_engine:common_closures_test_TEST_LIBRARY, config=BuildConfigurationKey[e7d0355b3d90789b06a9207238e0040e8b8404e05a204aa41ab02c9d9ba36c03]}, willTest=false}', 'ActionLookupData1{actionLookupKey=ConfiguredTargetKey{label=//test/core/event_engine:common_closures_test_TEST_LIBRARY, config=BuildConfigurationKey[e7d0355b3d90789b06a9207238e0040e8b8404e05a204aa41ab02c9d9ba36c03]}, actionIndex=1}')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:547)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:435)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: com.google.devtools.build.lib.rules.apple.DottedVersion$InvalidDottedVersionException: Dotted version components must all start with the form \d+([a-z0-9]*?)?(\d+)? but got 'None'
	at com.google.devtools.build.lib.rules.apple.DottedVersion.fromStringUnchecked(DottedVersion.java:181)
	at com.google.devtools.build.lib.exec.local.XcodeLocalEnvProvider.rewriteLocalEnv(XcodeLocalEnvProvider.java:95)
	at com.google.devtools.build.lib.sandbox.DarwinSandboxedSpawnRunner.prepareSpawn(DarwinSandboxedSpawnRunner.java:219)
	at com.google.devtools.build.lib.sandbox.AbstractSandboxSpawnRunner.exec(AbstractSandboxSpawnRunner.java:112)
	at com.google.devtools.build.lib.sandbox.SandboxModule$SandboxFallbackSpawnRunner.exec(SandboxModule.java:479)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:158)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:118)
	at com.google.devtools.build.lib.exec.SpawnStrategyResolver.exec(SpawnStrategyResolver.java:45)
	at com.google.devtools.build.lib.rules.cpp.CppCompileAction.execute(CppCompileAction.java:1395)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.executeAction(SkyframeActionExecutor.java:1170)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:1075)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:166)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:95)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:559)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:928)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.computeInternal(ActionExecutionFunction.java:375)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:216)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:467)
	... 7 more
Caused by: com.google.devtools.build.lib.rules.apple.DottedVersion$InvalidDottedVersionException: Dotted version components must all start with the form \d+([a-z0-9]*?)?(\d+)? but got 'None'
	at com.google.devtools.build.lib.rules.apple.DottedVersion.fromString(DottedVersion.java:203)
	at com.google.devtools.build.lib.rules.apple.DottedVersion.fromStringUnchecked(DottedVersion.java:179)
	... 24 more

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

macOS 15.3.2 (24D81)

What is the output of bazel info release?

release 8.0.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?


If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

$ which c++
/usr/bin/c++

$ c++ --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
@eugeneo
Copy link
Author

eugeneo commented Mar 28, 2025

Just noticed I can not build even default branch (https://github.com/grpc/grpc) so it looks like something on my env broke with some Bazel update or maybe OS update.

I'm a Googler, feel free to reach out internally.

@keith
Copy link
Member

keith commented Mar 28, 2025

probably the same local env issues as discussed on #23111

@eugeneo
Copy link
Author

eugeneo commented Mar 28, 2025

I needed to reinstall XCode.

I will change the title and description of this issue.

@eugeneo eugeneo changed the title Build on macOS fails. Make Bazel clearly communicate issues with XCode install Mar 28, 2025
@Wyverald
Copy link
Member

Either way, Bazel should not crash. @keith do you see a way for us to print a helpful error message instead of crashing?

@keith
Copy link
Member

keith commented Mar 28, 2025

yea for sure we can check for None in that codepath and error. It just doesn't come up too much so folks haven't been super motivated to improve it

@Wyverald
Copy link
Member

I'm also a bit personally curious -- why is this still in native code, actually? I thought this kind of stuff was taken care of by apple_support/rules_apple already.

@keith
Copy link
Member

keith commented Mar 28, 2025

this specific logic is doing non-hermetic stuff to make sure the absolute path to Xcode doesn't appear in the action keys. specifically the resulting path here

developerDir = getDeveloperDir(binTools, DottedVersion.fromStringUnchecked(version));
newEnvBuilder.put("DEVELOPER_DIR", developerDir);
is absolute and based on the host system's local installation location

@iancha1992 iancha1992 added the team-CLI Console UI label Mar 28, 2025
@oquenchil oquenchil added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website and removed team-CLI Console UI labels Apr 1, 2025
@meteorcloudy
Copy link
Member

Can we starlarkify XcodeLocalEnvProvider.java?

@meteorcloudy meteorcloudy added z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple under investigation P2 We'll consider working on this in future. (Assignee optional) untriaged P1 I'll work on this now. (Assignee required) and removed untriaged under investigation P2 We'll consider working on this in future. (Assignee optional) labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug z-team-Apple Deprecated. Send to rules_apple, or label team-Rules-CPP + platform:apple
Projects
None yet
Development

No branches or pull requests

8 participants