On Tuesday, November 15, 2016 at 4:46:39 PM UTC-8, Brian Silverman wrote:
> Try setting the environment variable CC=clang when you build. With newer versions, --client_env=CC=clang on the command line or in tools/bazel.rc should work too.
>
>
>
> I wrote clang instead of clang++ because Bazel uses the C frontend for compiling C++ code (with GCC and Clang at least) because the C frontend will compile both C and C++, but the C++ frontend will interpret C code as C++ which doesn't work.
>
>
> tools/cpp/cc_configure.bzl looks for that CC environment variable when it's configuring the C/C++ toolchain if you're interested in the implementation.
>
>
>
> On Tue, Nov 15, 2016 at 5:11 PM, 'Ahmed Fakhry' via bazel-discuss <
bazel-...@googlegroups.com> wrote:
>
> In BUCK, this is quit easy. One would specify the compiler binaries in the [cxx] section of the .buckconfig file. I tried to find something similar in Bazel, but couldn't.
>
>
>
>
> --
>
> 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.
CC=clang doesn't work with me in a Docker çontainer based on Ubuntu 16.04:
root@22c046161c61:/learn-bazel# CC=clang CXX=clang++ bazel build ...
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See
http://bazel.build/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 3 targets...
INFO: From Compiling lib/hello-greet.cc:
clang: warning: -Wl,-z,-relro,-z,now: 'linker' input unused
INFO: From Compiling main/hello-time.cc:
clang: warning: -Wl,-z,-relro,-z,now: 'linker' input unused
ERROR: /learn-bazel/lib/BUILD:1:1: Linking of rule '//lib:hello-greet' failed: process-wrapper failed: error executing command /root/.cache/bazel/_bazel_root/12e2eee6c4198c9fb4d44bfabadbc184/execroot/learn-bazel/_bin/process-wrapper -1 5 - - external/bazel_tools/tools/cpp/link_dynamic_library.sh no ignored ignored ignored ... (remaining 11 argument(s) skipped).
clang: error: unsupported option '-pass-exit-codes'
INFO: Elapsed time: 1.810s, Critical Path: 0.23s
The Dockerfile is at
https://github.com/wangkuiyi/learn-bazel/blob/master/clang/Dockerfile