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

Error when use with bazel --output_base flag #180

Open
LittleCuteBug opened this issue Apr 2, 2024 · 5 comments
Open

Error when use with bazel --output_base flag #180

LittleCuteBug opened this issue Apr 2, 2024 · 5 comments

Comments

@LittleCuteBug
Copy link

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']
@cpsauer
Copy link
Contributor

cpsauer commented Apr 4, 2024

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.

@LittleCuteBug
Copy link
Author

LittleCuteBug commented Apr 4, 2024

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.

@LittleCuteBug
Copy link
Author

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?

@cpsauer
Copy link
Contributor

cpsauer commented Apr 5, 2024

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

@LittleCuteBug
Copy link
Author

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.

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

No branches or pull requests

2 participants