Reputation: 14071
On a Ubuntu 16.04.2 I am trying to compile code with a newer gcc.
So I did the following:
tools/cpp/CROSSTOOL
local_linux
, change /usr/bin/gcc
to /usr/bin/gcc-7
bazel build //foo
When I output the commandline executed to build //foo:foo
, it calls /usr/bin/gcc
.
Can someone point out what I am doing wrong?
Upvotes: 2
Views: 461
Reputation: 3268
You are probably using static crosstool that is only used for bootstrapping and some tests (and some other details). What bazel usually uses is tools/cpp/CROSSTOOL.tpl which is a template populated by tools/cpp/cc_configure.bzl. This is the script that inspects CC environment variable and if set, it uses that for gcc.
Of course you can use static crosstool, you just have to tell bazel about it using --crosstool_top=//some/crosstool
flag. You can save it in a project local .bazelrc
.
Upvotes: 1