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

973 views
Skip to first unread message

zhangbo...@gmail.com

unread,
Nov 11, 2017, 5:08:55 AM11/11/17
to bazel-discuss
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.

Marcel Hlopko

unread,
Nov 14, 2017, 6:21:25 PM11/14/17
to zhangbo...@gmail.com, bazel-discuss
Cannot comment/investigate more right now, but I suspect that your new gcc assumes cc1 to be somewhere relative to the gcc. But that doesn't really work with bazel sandboxing (bazel copies inputs into sandbox to verify that you declared all your inputs. This is important to be able to rely on caching and to allow remote execution). You ideally need to tell bazel about all the inputs (including compilers). And that information is passed to bazel through cc_toolchain rules.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/1d26257c-0e2e-4870-8d20-007a67b17c88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 
Marcel Hlopko | Software Engineer | hlo...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891
Reply all
Reply to author
Forward
0 new messages