Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error building bazel and tensorflow with ccache #1322

Closed
chemelnucfin opened this issue May 30, 2016 · 4 comments
Closed

error building bazel and tensorflow with ccache #1322

chemelnucfin opened this issue May 30, 2016 · 4 comments
Labels
P2 We'll consider working on this in future. (Assignee optional)
Milestone

Comments

@chemelnucfin
Copy link

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.

@philwo
Copy link
Member

philwo commented Jun 15, 2016

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.

@saudet
Copy link

saudet commented Jun 18, 2016

With the following, it works on my Fedora 23:

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

saudet added a commit to bytedeco/javacpp-presets that referenced this issue Jun 18, 2016
@philwo philwo added the P2 We'll consider working on this in future. (Assignee optional) label Jun 18, 2016
@chemelnucfin
Copy link
Author

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

On Fri, Jun 17, 2016, 8:40 PM Samuel Audet notifications@github.com 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
#1322 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADzDDDT0YmGwoKVeXCL_lP-EKHMbNfVCks5qM2jJgaJpZM4Ip_lC
.

@damienmg
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional)
Projects
None yet
Development

No branches or pull requests

6 participants