Bazel: error building bazel and tensorflow with ccache

Created on 30 May 2016  Â·  4Comments  Â·  Source: bazelbuild/bazel

Current System: Fedora 23

I had tensorflow building a couple of weeks ago, but once I upgraded to the latest commits, I get these errors (more info after logs):

Bazel
./compile.sh
ERROR: /projects/bazel/src/main/tools/BUILD:26:1: Linking of rule '//src/main/tools:build-runfiles' failed: gcc failed: error executing command
(cd /tmp/bazel.RygeKR2a/out/bazel && \
exec env - \
/usr/lib64/ccache/gcc -o bazel-out/local-fastbuild/bin/src/main/tools/build-runfiles -no-canonical-prefixes -B/usr/lib64/ccache -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-rpath,/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/cuda/lib -L/usr/local/cuda/lib -Wl,-rpath,/usr/lib/nvidia -L/usr/lib/nvidia -Wl,-S -Wl,@bazel-out/local-fastbuild/bin/src/main/tools/build-runfiles-2.params): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
ccache: error: Could not find compiler "gcc" in PATH
Target //src:bazel failed to build

Tensorflow
bazel --output_base=/mnt/raid/projects/.cache test --config=cuda //tensorflow/... --verbose_failures
blaze: Entering directory /projects/.cache/tensorflow/' ____[0 / 223] Executing genrule @farmhash_archive//:configure ____[1 / 477] Linking external/gmock_archive/libgtest.so ERROR: /projects/.cache/external/gmock_archive/BUILD:1:1: Linking of rule '@gmock_archive//:gtest' failed: namespace-sandbox failed: error executing command (cd /projects/.cache/tensorflow && \ exec env - \ /projects/.cache/tensorflow/_bin/namespace-sandbox @/projects/.cache/tensorflow/bazel-sandbox/0c0146b5-bdd1-42fd-8e0b-1b813285236d-1.params -- /usr/lib64/ccache/gcc -shared -o bazel-out/local-fastbuild/bin/external/gmock_archive/libgtest.so -pthread -no-canonical-prefixes -Wl,-no-as-needed -B/usr/lib64/ccache -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-rpath,/usr/local/cuda/lib64 -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/cuda/lib -L/usr/local/cuda/lib -Wl,-rpath,/usr/lib/nvidia -L/usr/lib/nvidia -Wl,-S -Wl,@bazel-out/local-fastbuild/bin/external/gmock_archive/libgtest.so-2.params). ccache: error: Could not find compiler "gcc" in PATH blaze: Leaving directory/projects/.cache/tensorflow/'


which gcc
/usr/lib64/ccache/gcc

ls -al /usr/lib64/ccache/gcc
lrwxrwxrwx. 1 root root 16 May 21 10:03 /usr/lib64/ccache/gcc -> ../../bin/ccache

/usr/bin/ccache gcc --version
gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/usr/bin/ccache --version
ccache version 3.2.4

Copyright (C) 2002-2007 Andrew Tridgell
Copyright (C) 2009-2015 Joel Rosdahl

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.

P2

Most helpful comment

With the following, it works on my Fedora 23:

export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"

All 4 comments

The key here is: "ccache: error: Could not find compiler "gcc" in PATH".
gcc is in /usr/lib64/ccache, which is on @chemelnucfin's PATH.

However, Bazel resets the PATH to a hard-coded list that is wrong for your system (it does not include /usr/lib64/ccache).

@damienmg Should Bazel detect this automatically via C++ toolchain autoconfiguration? Or do we have a different mechanism for how this should work?

I'm pretty sure that this is not a sandboxing issue. I think the same error will happen with --spawn_strategy=standalone.

With the following, it works on my Fedora 23:

export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"

Worked great. Now let me see how to get it working in tensorflow.....
Thanks!

On Fri, Jun 17, 2016, 8:40 PM Samuel Audet [email protected] wrote:

With the following, it works on my Fedora 23:

export CC="/usr/bin/gcc"
export CXX="/usr/bin/g++"

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/bazel/issues/1322#issuecomment-226919588,
or mute the thread
https://github.com/notifications/unsubscribe/ADzDDDT0YmGwoKVeXCL_lP-EKHMbNfVCks5qM2jJgaJpZM4Ip_lC
.

Sorry yes we need to get the actual C++ compiler not the ccache.

Was this page helpful?
0 / 5 - 0 ratings