Open chenhao94 opened 2 years ago
cc toolchain is not correctly generated when using ccache with clang, while ccache with gcc works.
chenhao@chenhao:~/bazel-ccache$ cat WORKSPACE chenhao@chenhao:~/bazel-ccache$ cat BUILD cc_binary( name = "hello", srcs = ["hello.cc"], ) chenhao@chenhao:~/bazel-ccache$ cat hello.cc int main() { return 0; } chenhao@chenhao:~/bazel-ccache$ ls -alh tools total 8.0K drwxrwxr-x 2 chenhao chenhao 4.0K May 19 20:08 . drwxrwxr-x 3 chenhao chenhao 4.0K May 19 20:10 .. lrwxrwxrwx 1 chenhao chenhao 15 May 19 20:08 clang-12 -> /usr/bin/ccache lrwxrwxrwx 1 chenhao chenhao 15 May 19 20:08 gcc-10 -> /usr/bin/ccache chenhao@chenhao:~/bazel-ccache$ which ccache /usr/bin/ccache chenhao@chenhao:~/bazel-ccache$ which clang-12 /usr/bin/clang-12 chenhao@chenhao:~/bazel-ccache$ which gcc-10 /usr/bin/gcc-10 chenhao@chenhao:~/bazel-ccache$ CC=$(pwd)/tools/gcc-10 bazel build --sandbox_writable_path=$HOME/.ccache :all INFO: Analyzed target //:hello (1 packages loaded, 12 targets configured). INFO: Found 1 target... Target //:hello up-to-date: bazel-bin/hello INFO: Elapsed time: 1.512s, Critical Path: 0.04s INFO: 3 processes: 2 internal, 1 linux-sandbox. INFO: Build completed successfully, 3 total actions chenhao@chenhao:~/bazel-ccache$ CC=$(pwd)/tools/clang-12 bazel build --sandbox_writable_path=$HOME/.ccache :all INFO: Analyzed target //:hello (1 packages loaded, 12 targets configured). INFO: Found 1 target... ERROR: /home/chenhao/bazel-ccache/BUILD:1:10: Compiling hello.cc failed: (Exit 1): ccache failed: error executing command /usr/bin/ccache -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' -MD ... (remaining 21 arguments skipped) Use --sandbox_debug to see verbose messages from the sandbox /usr/bin/ccache: invalid option -- 'U' Usage: ccache [options] ...
Ubuntu 20.04
bazel info release
release 5.1.0. I also tried other 5.x and the latest 6.0-pre, all broken. 4.x does not have this issue.
I don't specify the rules_cc version by myself. My WORKSPACE is empty.
See the "bugs" section
Description of the problem / feature request:
cc toolchain is not correctly generated when using ccache with clang, while ccache with gcc works.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
Ubuntu 20.04
What's the output of
bazel info release
?release 5.1.0. I also tried other 5.x and the latest 6.0-pre, all broken. 4.x does not have this issue.
What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?
I don't specify the rules_cc version by myself. My WORKSPACE is empty.
What Bazel options do you use to trigger the issue? What C++ toolchain do you use?
See the "bugs" section