This logic may choose an incorrect clang directory if gclient sync fails to remove an old directory:
|
# Find "include" directory inside clang installation. This directory |
|
# will be symlinked by remote wrapper for cross-compilation to work. The |
|
# path is clang-version dependent, so don't hardcode it. |
|
clang_include_dir_glob = glob.glob( |
|
f'{Paths.clang_base_path}/lib/**/include', recursive=True) |
|
if not clang_include_dir_glob: |
|
raise RuntimeError( |
|
f'Cannot find lib/**/include dir in {Paths.clang_base_path}. ' |
|
f'If clang directory structure has changed, please update ' |
|
f'{Paths.abspath(__file__)} and {template_file} if required.') |
|
clang_include_dir_abs = Paths.normpath(clang_include_dir_glob[0]) |
|
assert os.path.isdir(clang_include_dir_abs), clang_include_dir_abs |
|
clang_include_dir = Paths.relpath(clang_include_dir_abs, |
|
Paths.build_dir) |
|
linux_clang_include_dir = Paths.relpath( |
|
clang_include_dir_abs.replace(Paths.clang_base_path, |
|
Paths.linux_clang_base_path), |
|
Paths.build_dir) |
This leads to clang_remote_wrapper trying to run a compiler with a symlink pointing nowhere, i.e. instead of:
clang_include_dir="../../third_party/llvm-build/Release+Asserts/lib/clang/20/include"
linux_clang_include_dir="../../third_party/llvm-build/Release+Asserts_linux/lib/clang/20/include"
we get:
clang_include_dir="../../third_party/llvm-build/Release+Asserts/lib/clang/19/include"
linux_clang_include_dir="../../third_party/llvm-build/Release+Asserts_linux/lib/clang/19/include"
A more robust approach is to search for the lib/**/include directory remotely and symlink it right in the clang_remote_wrapper script.
Another approach is to sort found directories and choose the last one instead of the first one.
This logic may choose an incorrect clang directory if
gclient syncfails to remove an old directory:reclient-configs/configure_reclient.py
Lines 171 to 188 in 7851c93
This leads to
clang_remote_wrappertrying to run a compiler with a symlink pointing nowhere, i.e. instead of:we get:
A more robust approach is to search for the
lib/**/includedirectory remotely and symlink it right in theclang_remote_wrapperscript.Another approach is to sort found directories and choose the last one instead of the first one.