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

rbe_configs_gen: confusing error when custom container contains .bazelrc #978

Open
notnarb opened this issue Jan 11, 2022 · 0 comments
Open

Comments

@notnarb
Copy link

notnarb commented Jan 11, 2022

Disclaimer: I understand this may be an invalid use case and I am using the tool tool incorrectly 🙃

Background:

My team needs to produce native CPP build for CentOS and CentOS 7 has an older version of glibc so we are using a CentOS-based custom container[1].

I thought I would be clever and define a custom platform within my sandbox container and included a build --host_platform //toolchain:centos in the bazelrc of our container allowing us to use constraints to prevent someone from accidentally building e.g. an RPM on Ubuntu.

Issue

Fast forward to an investigation into using RBE and I got a confusing error when running rbe_configs_gen

ERROR: While resolving toolchains for target @local_config_cc//:cc-compiler-k8: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package 'toolchain': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /workdir/cpp_configs_project/toolchain
ERROR: Analysis of target '@local_config_cc//:cc-compiler-k8' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package 'toolchain': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /workdir/cpp_configs_project/toolchain

@local_config_cc// wha? is Bazel somehow broken?

I now now realize this was due to Bazel reading the .bazelrc defined in the container and this is admittedly self-inflicted but it took me quite a while to figure this out. Removing the .bazelrc file from our container solves the problem.

Suggested Solutions

  1. Do nothing, hopefully anyone who runs into this issue finds this issue by the keywords I included in this issue

  2. add --bazelrc=/dev/null to the bazel commands run by rbe_configs_gen

I think doing nothing is a perfectly acceptable solution, my main reason for raising this issue is making it searchable in case anyone makes the same mistake in the future.


[1] Maybe we would be better served by extending an existing ubuntu rbe base image and installing the desired version of GCC but for now we are exploring making a custom container based on CentOS to try to closely match the target environment.

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

1 participant