Closed bsirang closed 3 years ago
More info:
Here's the bazel version I'm using: bazel 4.2.1
Here's the working case I have so far:
Here's the non-working cases I have found so far:
Perhaps this is relevant: https://github.com/bazelbuild/bazel/issues/12712
I have run into this once or twice, but haven't really been able to zero in on it and reproduce it once it starts working again.
Here's the working case I have so far: Regular user in Ubuntu VM
What version of ubuntu are you running?
Here's the non-working cases I have found so far:
- root user (via sudo command) in Ubuntu VM
- docker environment (as root)
This should work, but I would recommend against using root for you builds for security reasons.
Just as a hunch I would guess that this is something to do with how your bazelrc is being resolved with different users. Do you have a .bazelrc file in your workspace or in your home directory? The first thing I would try is to ensure that you have a .bazelrc
in your workspace and that it is present in your Docker container. It should contain at least the following;
# Enable toolchain resolution with cc
build --incompatible_enable_cc_toolchain_resolution
Or alternatively, just add --incompatible_enable_cc_toolchain_resolution
to your command line.
If debugging the .bazelrc doesn't work would you mind posting a minimal set of steps to reproduce the problem i.e. basic workspace + Dockerfile etc? If the project is open source a URL should suffice.
Ahh everything makes sense now...
You were right... I inadvertently had a .bazelrc
in my home directory in addition to my workspace. I had that --incompatible_enable_cc_toolchain_resolution
flag there hence why it worked in one of the four scenarios I listed.
It's still interesting the --toolchain_resolution_debug
didn't help pinpoint the issue.
Anyway, I'll go ahead and close this one out.
I'm having trouble with the
bazel-embedded
rules in some cases. In a plain Ubuntu host, I can build my target with--platforms=@bazel_embedded//platforms:cortex_m7_fpu
and it works fine and invokesexternal/bazel_embedded/toolchains/gcc_arm_none_eabi/gcc_wrappers/nix/gcc
However when I run the same thing in a docker environment (based on Ubuntu) it attempts to use
/usr/bin/gcc
and fails because-mthumb
doesn't exist.I used the
--toolchain_resolution_debug
flag and interestingly, in both the working and non-working case it output the exact same thing (I diff'd and they were exactly the same):