bazelbuild / bazelbuild/examples
cpp-tutorial doesn't work on AArch64 systems
- Dominant language
- Starlark
- Stars
- 957
- Forks
- 578
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 1
Description
Hello,
I was following the Bazel C++ build tutorial, and for stage1, I got the following:
```
$ bazel build //main:hello-world
Starting local Bazel server and connecting to it...
ERROR: While resolving toolchains for target //main:hello-world: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.
ERROR: Analysis of target '//main:hello-world' failed; build aborted: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.
INFO: Elapsed time: 3.004s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (12 packages loaded, 18 targets configured)
```
Digging into this, it appears that the `WORKSPACE` file has explicit references to X86 architecture. Changing this AArch64 then resulted in Bazel bombing out trying to run x86 binaries on my AArch64 system :-(. Also, the `.bazelrc` file was purposefully preventing the system supplied compiler from being used.
In the end I got everything working as I expected thusly,
```
$ rm WORKSPACE .bazelrc && touch WORKSPACE
$ bazel build //main:hello-world
```
Would it be possible to please simplify the tutorial to getting stuff building reliably and simply to begin with, then for folks who want to employ custom toolchains/etc have a separate stage for that?
Contributor guide
Assessment
This issue has not been assessed yet.