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

Tree artifact as input to cc_library fails if it contains object files #6963

Closed
robin-thomas opened this issue Dec 19, 2018 · 1 comment
Closed
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug

Comments

@robin-thomas
Copy link

robin-thomas commented Dec 19, 2018

Description of the problem / feature request:

If the input to cc_library is a tree artifact, which contains only object files, then bazel build crashes with the below stack trace.

ERROR: Artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>/<file>.o' expanded from the directory artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>' is neither header nor source file.
Internal error thrown during build. Printing stack trace: java.lang.IllegalArgumentException: action terminated with unexpected exception: Artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>/<file>.o' expanded from the directory artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>' is neither header nor source file.
	at com.google.devtools.build.lib.buildtool.SkyframeBuilder.rethrow(SkyframeBuilder.java:334)
	at com.google.devtools.build.lib.buildtool.SkyframeBuilder.processResult(SkyframeBuilder.java:290)
	at com.google.devtools.build.lib.buildtool.SkyframeBuilder.buildArtifacts(SkyframeBuilder.java:165)
	at com.google.devtools.build.lib.buildtool.ExecutionTool.executeBuild(ExecutionTool.java:341)
	at com.google.devtools.build.lib.buildtool.BuildTool.buildTargets(BuildTool.java:164)
	at com.google.devtools.build.lib.buildtool.BuildTool.processRequest(BuildTool.java:253)
	at com.google.devtools.build.lib.runtime.commands.BuildCommand.exec(BuildCommand.java:83)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:482)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:204)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:750)
	at com.google.devtools.build.lib.server.GrpcServerImpl.access$1600(GrpcServerImpl.java:103)
	at com.google.devtools.build.lib.server.GrpcServerImpl$2.lambda$run$0(GrpcServerImpl.java:819)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.google.devtools.build.lib.actions.ActionTemplate$ActionTemplateExpansionException: Artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>/<file>.o' expanded from the directory artifact 'bazel-out/k8-fastbuild/bin/<tree_artifact>' is neither header nor source file.
	at com.google.devtools.build.lib.rules.cpp.CppCompileActionTemplate.generateActionForInputArtifacts(CppCompileActionTemplate.java:109)
	at com.google.devtools.build.lib.skyframe.ActionTemplateExpansionFunction.compute(ActionTemplateExpansionFunction.java:79)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:422)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:368)
	... 3 more

Feature requests: what underlying problem are you trying to solve with this feature?

Fix tree artifact so that they can have *.o files which can be accepted by cc_library

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

git clone https://github.com/robin-thomas/bazelify-gmp.git
cd bazelify-gmp
git checkout 18e719924200d486ab101ca35a08f36ba43a68eb
bazel build ...

What operating system are you running Bazel on?

Ubuntu 16.04

What's the output of bazel info release?

release 0.20.0

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

git@github.com:robin-thomas/bazelify-gmp.git
18e719924200d486ab101ca35a08f36ba43a68eb
18e719924200d486ab101ca35a08f36ba43a68eb

Have you found anything relevant by searching the web?

This one seems similar: #5092. But the stack trace is different (as that issue looks fixed)

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

Seems like the issue is here: https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionTemplate.java#L107

@robin-thomas robin-thomas changed the title Tree artifact for input fails if input is object files Tree artifact as input to cc_library fails if it contains only object files Dec 20, 2018
@robin-thomas robin-thomas changed the title Tree artifact as input to cc_library fails if it contains only object files Tree artifact as input to cc_library fails if it contains object files Dec 20, 2018
@irengrig irengrig added team-Rules-CPP Issues for C++ rules untriaged labels Dec 20, 2018
@hlopko hlopko added P2 We'll consider working on this in future. (Assignee optional) type: bug Bazel 1.0 and removed untriaged labels Jan 9, 2019
@dslomov dslomov removed the bazel 1.0 label Jul 24, 2019
@c-mita c-mita added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P2 We'll consider working on this in future. (Assignee optional) labels Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

No branches or pull requests

6 participants
@hlopko @robin-thomas @c-mita @dslomov @irengrig and others