Error when use with bazel --output_base flag
LittleCuteBug opened this issue · comments
when run with bazel --output_base bazel-cache run @hedron_compile_commands//:refresh_all
I got the following error, can anyone provide help?
ERROR: error loading package 'bazel-hello_world/external/bazel_tools/src/conditions': Every .bzl file must have a corresponding package, but '//tools/windows:windows_config.bzl' does not have one. Please create a BUILD file in the same or any parent directory. Note that this BUILD file does not need to do anything except exist.
Bazel aquery failed. Command: ['bazel', 'aquery', "mnemonic('(Objc|Cpp|Cuda)Compile',deps(@//...))", '--output=jsonproto', '--include_artifacts=false', '--ui_event_filters=-info', '--noshow_progress', '--features=-compiler_param_file', '--features=-layering_check']
Hey @LittleCuteBug! Thanks for giving the tool a whirl. This is...a very strange one. Those are internal bazel tools failing to have been instantiated properly. Do things work properly if you remove the --output_base bazel-cache
, add it to your bazelrc, or also pass it to our subcommands by appending -- --output_base bazel-cache
(see the flag configuration section of the readme for more.)? I'm guessing the problem is that the tool is getting a different output base at runtime from compile time.
Hi @cpsauer, I have also tried the .bazelrc and -- --output_base bazel-cache
and still have the same error.
Without the --output_base bazel-cache
, the bazel run @hedron_compile_commands//:refresh_all
works fine for me.
I'm guessing the problem is that the tool is getting a different output base at runtime from compile time.
Yes, I think that is the problem too.
Hi @cpsauer, I think I found the reason, it's because I set the output_base inside the workspace, so the hedron_compile_commands tried to check in that directory also.
Is there any way to exclude that directory?
Oh! interesting. Sounds like all works fine if the output_base is outside the workspace? If so, this really seems like a Bazel bug...and worth reporting to them.
To help scope:
- Are you indeed on Windows?
- Does that aquery command (and simpler versions of it) also fail with the output_base set? (I'm trying to see if we can remove this tool from the equation.)
- Excluding: Might a .bazelignore work? https://bazel.build/run/bazelrc#bazel-behavior-files
yes, I have managed to work with the combination of startup --output_base=bazel-cache
in the .bazelrc and bazel-cache
in the .bazelignore file.
A small interesting issue is the query command used in the hedron_compile_commands only takes effect of the .bazelrc when the hedron_compile_commands repo is imported by git_repository
rule or local_repository
rule. if I included it with http_archive, the .bazelrc config seems not to take effect.