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

add cc config info to dummy wasm32 cc toolchain #1532

Merged
merged 2 commits into from
Aug 29, 2022

Conversation

kcking
Copy link
Contributor

@kcking kcking commented Aug 29, 2022

Fixes building with new cc toolchain resolution flag --incompatible_enable_cc_toolchain_resolution=1, which I am using in a project that involves a cross-compiled native rust web-server serving rust compiled to wasm.

fixes building with new cc toolchain resolution flag
Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kcking! Can you provide an stacktrace or example of the error you get without this change?

@kcking
Copy link
Contributor Author

kcking commented Aug 29, 2022

Sure thing, here's a more minimal repro of the issue: https://github.com/kcking/bazel-repro-1532

The stack trace is

Analyzing: target //:wasm-and-bin (196 packages loaded, 8245 targets configured)
FATAL: bazel crashed due to an internal error. Printing stack trace:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'ConfiguredTargetKey{label=@bazel_tools//tools/cpp:current_cc_toolchain, config=BuildConfigurationValue.Key[92e5d91b302bd50add78c487b06a677a8c261db39969e92317ccc69c68cd948e]}' (requested by nodes 'ConfiguredTargetKey{label=//:bin, config=BuildConfigurationValue.Key[92e5d91b302bd50add78c487b06a677a8c261db39969e92317ccc69c68cd948e]}', 'ToolchainDependencyConfiguredTargetKey{label=@rust_darwin_aarch64__wasm32-unknown-unknown_tools//:rust_toolchain, config=BuildConfigurationValue.Key[92e5d91b302bd50add78c487b06a677a8c261db39969e92317ccc69c68cd948e], executionPlatformLabel=@local_config_platform//:host}')
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:674)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException
        at com.google.devtools.build.lib.rules.cpp.CcToolchain.createMakeVariableProvider(CcToolchain.java:122)
        at com.google.devtools.build.lib.rules.cpp.CcToolchainAliasRule$CcToolchainAlias.create(CcToolchainAliasRule.java:78)
        at com.google.devtools.build.lib.rules.cpp.CcToolchainAliasRule$CcToolchainAlias.create(CcToolchainAliasRule.java:69)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:364)
        at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:188)
        at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:1108)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:980)
        at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:368)
        at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:590)
        ... 7 more

I noticed a related issue bazelbuild/bazel#15304 was closed, but independently rules_rust should be providing a well-formed cc toolchain config.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

@UebelAndre UebelAndre enabled auto-merge (squash) August 29, 2022 18:52
@UebelAndre UebelAndre merged commit b8751b8 into bazelbuild:main Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants