Jack Humphries
Jack Humphries

Reputation: 13267

Have rules_cc use latest version of GCC

I am using Bazel to build my project. One of the dependencies is Abseil, which in turn depends on rules_cc.

I notice that when I have multiple versions of GCC installed, rules_cc may be directing Bazel to use an older version of GCC even though I want the newest version of GCC to be used. To get around this, I have been manually editing bazel-project/external/local_config_cc/BUILD to reference the newest version of GCC.

Is there a better or "right" way to do this?

Upvotes: 0

Views: 1248

Answers (1)

slsy
slsy

Reputation: 1304

Add that flag to .buildrc (or to your bazel build invocation):

build --action_env=CC=/path/to/your/gcc

you can also set a CXX variable, but at this moment only a CC is used by Bazel

That approach use toolchain automatically generated by Bazel. You can also create your own toolchain, but it is a complicated process.

Upvotes: 1

Related Questions