@@ -31,6 +31,33 @@ build --spawn_strategy=standalone
31
31
32
32
###########################################################################
33
33
34
+ build:clang --action_env=CC=/usr/bin/clang-17
35
+ build:clang --action_env=CXX=/usr/bin/clang++-17
36
+
37
+ # clang requires the sandbox mode. Without this, `bazel build` generates an
38
+ # error like:
39
+ #
40
+ # ERROR: .../external/llvm-project/llvm/BUILD.bazel:2006:11: Compiling
41
+ # llvm/lib/CodeGenTypes/LowLevelType.cpp failed: undeclared inclusion(s) in
42
+ # rule '@llvm-project//llvm:CodeGenTypes':
43
+ # this rule is missing dependency declarations for the following files
44
+ # included by 'llvm/lib/CodeGenTypes/LowLevelType.cpp':
45
+ # 'bazel-out/k8-opt/bin/external/llvm-project/llvm/config.cppmap'
46
+ # 'bazel-out/k8-opt/bin/external/llvm-project/llvm/Demangle.cppmap'
47
+ #
48
+ # The sandbox mode requires all source files to be readable by others, as
49
+ # inside the docker we build PyTorch/XLA as root, not the original user who
50
+ # created the files. You can ensure this by either:
51
+ # 1. `umask 022` before running the `git clone` commands, or
52
+ # 2. after running the `git clone` commands, go to the workspace directory
53
+ # and run `chmod -R o+rX .`. The X (capital X) is important: it gives
54
+ # execute permission to directories, and to files only if they already have
55
+ # execute permission for the owner (or group or others). This is generally
56
+ # safer than o+rx.
57
+ build:clang --spawn_strategy=sandboxed
58
+
59
+ ###########################################################################
60
+
34
61
build:posix --copt=-Wno-sign-compare
35
62
build:posix --cxxopt=-std=c++17
36
63
build:posix --host_cxxopt=-std=c++17
0 commit comments