cpp-tutorial doesn't work on AArch64 systems

Open
#384 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start with the stage1 C++ tutorial and inspect its WORKSPACE and .bazelrc files, focusing on the explicit x86 references and compiler settings. Run bazel build //main:hello-world on an AArch64 system to reproduce the failure. Done means the introductory tutorial builds reliably without requiring users to remove those files, while custom toolchains remain a separate concern.

Written by the indexing model from the issue text.

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?

Dominant language
Starlark
Stars
957
Forks
578
Avg merge
2d 10h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bazelbuild/examples

All issues in bazelbuild/examples

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.