Bazel: How to change the default compiler for bazel when building tensorflow?

Created on 13 Nov 2017  Â·  9Comments  Â·  Source: bazelbuild/bazel

Hi,
I build tensorflow successfully using the default installation of bazel. Now, I want to use my custom gcc/g++ compiler(for example: linaro gcc) compiler to build some tensorflow examples. But I got the following error:

gcc: error trying to exec 'cc1': execvp: No such file or directory

here is my steps:

  1. export CC=/my/path/gcc
    export CXX=/my/path/g++

  2. bazel build tensorflow/examples/wav_to_spectrogram/...

  3. got the previous error msg, but i confirm that cc1 indeed exists.

some information:

bazel version: bazel release 0.7.0(install from apt-get install bazel)
os: ubuntu 14.04
tensorflow: r1.4(from github)

I think this maybe a common question: how to change the default compiler for bazel?
I try to find the answer from google, but not luck.

Can anyone give some advice? I will be appreciate.

Thanks.

under investigation

Most helpful comment

CROSSTOOL has poor documentation. I just want to use a newer compiler. Every CROSSTOOL file I find is ~1,000 lines. I didn't succeed either.

All 9 comments

This is a similar issue, but not solved.

https://groups.google.com/forum/#!topic/bazel-discuss/U4yMaZGPqe4

/cc @mhlopko

This is more of a question for Stack Overflow, not an actual issue. Could you follow up on this question?
https://stackoverflow.com/questions/41356173/how-to-use-clang-instead-g-in-bazel
Thanks. I will close this issue now, let me know if you disagree :)

ok.Thanks.
Now I used a tircky way to solve the problem(just replace the system gcc
with my gcc). The official way using CROSSTOOL is a little complex and I
didn't success.

On Tue, Nov 21, 2017 at 5:54 PM, Marcel Hlopko notifications@github.com
wrote:

This is more of a question for Stack Overflow, not an actual issue. Could
you follow up on this question?
https://stackoverflow.com/questions/41356173/how-to-use-
clang-instead-g-in-bazel
Thanks. I will close this issue now, let me know if you disagree :)

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/4077#issuecomment-345974664,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AcOGoSrFBcVyP8JFoze8FvieflGYpeijks5s4p3rgaJpZM4QbMpR
.

CROSSTOOL has poor documentation. I just want to use a newer compiler. Every CROSSTOOL file I find is ~1,000 lines. I didn't succeed either.

Bazel detects the compiler on the first build, plus it reevalutes on change of many env variables, most relevant is CC. You can force reevaluation (e.g. when you upgrade gcc binary) by running bazel clean --expunge, or with newer bazels using bazel sync.

For both of you setting CC doesn't work? Can you elaborate?

I'm only talking about toolchain detection bundled with Bazel. If you have isssues with e.g. tensorflow toolchain detection, you have to file issues over there.

I've re-checked the CC option and it worked. Sorry for the noise :( I've deleted my comment regarding the issue.

Okay, CC is good enough for me too. Its not as hermetic, but CROSSTOOL was too hard to configure.

I'll close this issue now, I think it's well covered with other issues that are not TF specific. Especially #5186. Thanks!

Was this page helpful?
0 / 5 - 0 ratings