-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Issue locating runfiles directory for toolchains dependencies #5463
Comments
The error "Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.)" is from the bash Java launcher script that is wrapping scalac. Looking further to see why this problem is happening. |
And now I can reproduce this on Linux, when I couldn't last week. |
Okay, I've tracked down the symptoms here:
It the last part that I am currently trying to figure out: where should that have been handled, and why isn't it working? |
Me and @andyscott encountered a similar problem last week while trying to pass an executable through a provider. I was able to get this building using the same fix we used for that. Not sure if this is of any help when fixing this. Anyways, here are the steps I used:
To get it to work from another workspace we also needed to add |
@jhnj Thanks for the pointer, that does seem to work for me. I hadn't realized that the inputs also needs the runfiles_manifest. This seems to be a consequence of the fact that java_binaries (unlike cc_binaries) aren't a single file, but a launcher and a runfiles directory. I am seeing another error:
and I am trying to see if I can figure that out. @johnynek Any ideas about what's wrong with ScalaCInvoker? |
@katre I don't know what the issue is there. focused_zip_importer is a library used with thrift generation, so the fact that it can't find ScalaCInvoker does not stand out as special (except that thrift generation happens in macro generally: |
focused_zip_importer is the specific target I picked to test so I wasn't getting breakpoints on every target. I'm not sure why it can't find ScalaCInvoker. |
I've attached a patch that makes the original PR seem to work (I can't figure out the ScalaCInvoker issue, but the scalac worker is actually starting). I think it'd be nicer if toolchains just automatically supplied their runfiles to actions, but this needs some thinking and I'll want to discuss it with others on the team. Using manual runfiles handling like in this patch has the advantage that you can precisely control which actions are rerun when inputs change. |
Thanks for looking into it. I would really like it to be able to work as zipper does: we shouldn't have to care if a target executable is a java rule or a C++ rule. It should be transparent. Otherwise, refactoring upstream code can break downstream. |
What I would like to see is the |
@benjaminp , that looks like the exact right thing to do. Since that is more general than this bug, I started a thread about it here: https://groups.google.com/forum/#!topic/starlark/3Oot_a5ife0 |
… tools= and executable=. This makes sense because FilesToRunProvider is the data structure that actually represents an executable. Previously, we had to resort to fishing out the runfiles of binaries using a back channel that knew only about the direct inputs of the rule being analyzed. Fixes bazelbuild#5463. RELNOTES: None. PiperOrigin-RevId: 229699575
Originally reported by @johnynek, during testing of bazelbuild/rules_scala#530
If you take the PR, and sync the rules_scala repo to commit 2071aa4, and run
bazel clean && bazel build //src/...
, you get an error:Oddly, syncing to the parent commit (afa6403) does not produce this error.
There's nothing obvious about the changes in 2071aa4 that would affects the runfiles directory, except that it shows more use of toolchains dependencies.
See the bazel-discuss thread at https://groups.google.com/forum/#!topic/bazel-discuss/4P3jiFsUggw for additional context.
The text was updated successfully, but these errors were encountered: