Description of the problem:
When using a configuration transition with a C++ build rule, if there is a .so file in the transitive deps of the transitioned target, Bazel crashes with the following stack trace:
Stack trace
Internal error thrown during build. Printing stack trace: java.lang.RuntimeException: Unrecoverable error while evaluating node '//:foo-getter-opt BuildConfigurationValue.Key[d534253f7f366fdfbb590befef52e47f] false' (requested by nodes )
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:531)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.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.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877)
at com.google.devtools.build.lib.vfs.PathFragment.startsWith(PathFragment.java:296)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.addLinkerInputs(LibrariesToLinkCollector.java:248)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.collectLibrariesToLink(LibrariesToLinkCollector.java:203)
at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(CppLinkActionBuilder.java:864)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamicLinkAction(CcLinkingHelper.java:769)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkActions(CcLinkingHelper.java:452)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkingHelper.java:362)
at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLinkingActions(CcBinary.java:833)
at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:489)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:265)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:80)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:338)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:184)
at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:767)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:899)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:344)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:454)
... 7 more
INFO: Elapsed time: 1.475s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (14 packages loaded, 83 targets configured)
Internal error thrown during build. Printing stack trace: java.lang.RuntimeException: Unrecoverable error while evaluating node '//:foo-getter-opt BuildConfigurationValue.Key[d534253f7f366fdfbb590befef52e47f] false' (requested by nodes )
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:531)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.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.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877)
at com.google.devtools.build.lib.vfs.PathFragment.startsWith(PathFragment.java:296)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.addLinkerInputs(LibrariesToLinkCollector.java:248)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.collectLibrariesToLink(LibrariesToLinkCollector.java:203)
at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(CppLinkActionBuilder.java:864)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamicLinkAction(CcLinkingHelper.java:769)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkActions(CcLinkingHelper.java:452)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkingHelper.java:362)
at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLinkingActions(CcBinary.java:833)
at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:489)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:265)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:80)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:338)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:184)
at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:767)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:899)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:344)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:454)
... 7 more
java.lang.RuntimeException: Unrecoverable error while evaluating node '//:foo-getter-opt BuildConfigurationValue.Key[d534253f7f366fdfbb590befef52e47f] false' (requested by nodes )
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:531)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:399)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.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.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877)
at com.google.devtools.build.lib.vfs.PathFragment.startsWith(PathFragment.java:296)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.addLinkerInputs(LibrariesToLinkCollector.java:248)
at com.google.devtools.build.lib.rules.cpp.LibrariesToLinkCollector.collectLibrariesToLink(LibrariesToLinkCollector.java:203)
at com.google.devtools.build.lib.rules.cpp.CppLinkActionBuilder.build(CppLinkActionBuilder.java:864)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createDynamicLinkAction(CcLinkingHelper.java:769)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.createCcLinkActions(CcLinkingHelper.java:452)
at com.google.devtools.build.lib.rules.cpp.CcLinkingHelper.link(CcLinkingHelper.java:362)
at com.google.devtools.build.lib.rules.cpp.CcBinary.createTransitiveLinkingActions(CcBinary.java:833)
at com.google.devtools.build.lib.rules.cpp.CcBinary.init(CcBinary.java:489)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:265)
at com.google.devtools.build.lib.rules.cpp.CcBinary.create(CcBinary.java:80)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createRule(ConfiguredTargetFactory.java:338)
at com.google.devtools.build.lib.analysis.ConfiguredTargetFactory.createConfiguredTarget(ConfiguredTargetFactory.java:184)
at com.google.devtools.build.lib.skyframe.SkyframeBuildView.createConfiguredTarget(SkyframeBuildView.java:767)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.createConfiguredTarget(ConfiguredTargetFunction.java:899)
at com.google.devtools.build.lib.skyframe.ConfiguredTargetFunction.compute(ConfiguredTargetFunction.java:344)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:454)
FAILED: Build did NOT complete successfully (14 packages loaded, 83 targets configured)
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Apply the following patch to an empty directory (with patch -p1 < 0001-Repro-Bazel-crash.patch.txt) and run bazel build //:foo-getter-opt
0001-Repro-Bazel-crash.patch.txt
Basically, this is a seemingly straightforward use of configuration transitions that works fine unless a .so file appears in the srcs of something upstream of the transition. In this example, I transitioned on //command_line_option:compilation_mode, but when I encountered the problem I was transitioning on a user-defined build setting.
What operating system are you running Bazel on?
Ubuntu 16.04, x86_64
What's the output of bazel info release?
Discovered on 0.28.1, reproduced on 6392e5c
If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.
Clean clone of Bazel, bazel build //src:bazel using Bazel 0.28.1.
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
https://github.com/bazelbuild/bazel
00e9d16d69b191bdfdc32bfd6b2bed203e5af844
6392e5c09ce10476fce33c13678f1c445f27ff66
Have you found anything relevant by searching the web?
Different crash related to configuration transitions -- #8936
Any other information, logs, or outputs that you want to share?
Appears to be a failure of the precondition at
|
libDir.startsWith(solibDir) || libDir.startsWith(toolchainLibrariesSolibDir), |
In particular, here is the value of libDir and solibDir:
- libDir:
bazel-out/k8-opt-ST-f87b14d253ada1bf84e725ab51e04286/bin/_solib_k8/_U_S_S_Cfoo-user___U
- solibDir:
bazel-out/k8-fastbuild/bin/_solib_k8
Note that the solibDir is not a prefix of libDir, violating the tested precondition. This appears to be due to the alternative bazel-out subdirectory used when building with configuration transitions.
Description of the problem:
When using a configuration transition with a C++ build rule, if there is a
.sofile in the transitive deps of the transitioned target, Bazel crashes with the following stack trace:Stack trace
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Apply the following patch to an empty directory (with
patch -p1 < 0001-Repro-Bazel-crash.patch.txt) and runbazel build //:foo-getter-opt0001-Repro-Bazel-crash.patch.txt
Basically, this is a seemingly straightforward use of configuration transitions that works fine unless a
.sofile appears in thesrcsof something upstream of the transition. In this example, I transitioned on//command_line_option:compilation_mode, but when I encountered the problem I was transitioning on a user-defined build setting.What operating system are you running Bazel on?
Ubuntu 16.04, x86_64
What's the output of
bazel info release?Discovered on 0.28.1, reproduced on 6392e5c
If
bazel info releasereturns "development version" or "(@Non-Git)", tell us how you built Bazel.Clean clone of Bazel,
bazel build //src:bazelusing Bazel 0.28.1.What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD?Have you found anything relevant by searching the web?
Different crash related to configuration transitions -- #8936
Any other information, logs, or outputs that you want to share?
Appears to be a failure of the precondition at
bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java
Line 245 in 0bb860d
In particular, here is the value of
libDirandsolibDir:bazel-out/k8-opt-ST-f87b14d253ada1bf84e725ab51e04286/bin/_solib_k8/_U_S_S_Cfoo-user___Ubazel-out/k8-fastbuild/bin/_solib_k8Note that the
solibDiris not a prefix oflibDir, violating the tested precondition. This appears to be due to the alternative bazel-out subdirectory used when building with configuration transitions.