How to follow tutorial for configuring C++ toolchains

370 views
Skip to first unread message

Davorin Mista

unread,
Oct 28, 2022, 4:58:20 PM10/28/22
to bazel-discuss
Hey guys, I must be missing some basic fundamentals here because I can't even follow step 1 of this tutorial:

Bazel Tutorial: Configure C++ Toolchains

I created .bazelrc, BUILD, and hello-world.c as per the instructions yet when I try to build I get entirely different errors than expected:

 bazel build --config=clang_config
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
.bazelrc
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
ERROR: The 'build' command is only supported from within a workspace (below a directory having a WORKSPACE file).

Hopefully someone can enlighten me.
Thanks,
Davorin

Konstantin

unread,
Nov 12, 2022, 6:03:55 PM11/12/22
to bazel-discuss
What exactly are you trying to achieve by configuring C++ toolchain? I ask because toolchain configuration is already medium advanced topic and I suspect you just don't need it yet.
What platform are you on?

--  not invoked from within a workspace (below a directory having a WORKSPACE file)
This seems to be the root of the problem. After you clone the sample project from here you supposed to change the current directory to the root of the workspace (it is where WORKSPACE file is) and run Bazel commands from there. I would simply start with `bazel build main:hello-world` without fiddling with the toolchain.

Konstantin

Reply all
Reply to author
Forward
0 new messages