blob: 40839b25268829450663f80a326c0be167bd6562 [file] [log] [blame]
diff --git tools/clang_util.py tools/clang_util.py
index 48354721..055d3710 100644
--- tools/clang_util.py
+++ tools/clang_util.py
@@ -18,6 +18,14 @@ if sys.platform == 'win32':
else:
clang_format_exe = 'clang-format'
+# Prefer using non-Depot Tools clang-format for Linux builds. The clang-format
+# from Depot Tools fails on some Linux Kokoro machines because of dynamic linker
+# errors. Use the clang-format we explicitly install instead (if it is in fact
+# installed on the machine). See b/122266829.
+if (sys.platform == 'linux2' and
+ os.path.isfile('/usr/lib/llvm-3.9/bin/clang-format')):
+ clang_format_exe = '/usr/lib/llvm-3.9/bin/clang-format'
+
def clang_format(file_name, file_contents):
# -assume-filename is necessary to find the .clang-format file and determine