I am wondering why clang-tidy
does not find includes with libc++
but does with libstdc++
when configured
with CXX_CLANG_TIDY=clang-tidy
:
The compile command which works with linux-clang-libstc++-debug
is:
/usr/local/bin/cmake \
-E \
__run_co_compile \
--launcher=/usr/bin/ccache \
--tidy="/usr/bin/clang-tidy;-header-filter=.;-extra-arg=-Wno-unknown-warning-option;-checks=-clang-diagnostic-unused-command-line-argument;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" \
--source=/workspaces/cmake-general/tests/project/build/linux-clang-libstdc++-debug/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.cxx \
-- \
/usr/bin/clang++-13 \
-DCARES_STATICLIB \
-DFMT_SHARED \
-D_GLIBCXX_USE_CXX11_ABI=1 \
-I/workspaces/cmake-general/tests/project/src \
-I/workspaces/cmake-general/tests/project/build/linux-clang-libstdc++-debug/src \
-g \
-fPIE \
-stdlib=libstdc++ \
-fcolor-diagnostics \
-fdebug-default-version=5 \
-Wall \
-Wextra \
-Wshadow \
-Wnon-virtual-dtor \
-Wold-style-cast \
-Wcast-align \
-Wunused \
-Woverloaded-virtual \
-Wpedantic \
-Wconversion \
-Wsign-conversion \
-Wnull-dereference \
-Wdouble-promotion \
-Wformat=2 \
-Wsuggest-override \
-Wmisleading-indentation \
-Werror \
-fsanitize=address \
-fsanitize=undefined,bounds \
-fno-sanitize-recover=undefined,bounds \
-fno-omit-frame-pointer \
-std=c++20 \
-Winvalid-pch \
-fpch-instantiate-templates \
-Xclang \
-emit-pch \
-Xclang \
-include \
-Xclang \
/workspaces/cmake-general/tests/project/build/linux-clang-libstdc++-debug/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx \
-x \
c++-header \
-MD \
-MT \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch \
-MF \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch.d \
-o \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch \
-c \
/workspaces/cmake-general/tests/project/build/linux-clang-libstdc++-debug/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.cxx
but with linux-clang-libc++-debug
/usr/local/bin/cmake \
-E \
__run_co_compile \
--launcher=/usr/bin/ccache \
--tidy="/usr/bin/clang-tidy;-header-filter=.;-extra-arg=-Wno-unknown-warning-option;-checks=-clang-diagnostic-unused-command-line-argument;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" \
--source=/workspaces/cmake-general/tests/project/build/linux-clang-libc++/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.cxx \
-- \
/usr/bin/clang++-13 \
-DCARES_STATICLIB \
-DFMT_SHARED \
-D_GLIBCXX_USE_CXX11_ABI=1 \
-I/workspaces/cmake-general/tests/project/src \
-I/workspaces/cmake-general/tests/project/build/linux-clang-libc++/src \
-g \
-fPIE \
-stdlib=libc++ \
-fcolor-diagnostics \
-fdebug-default-version=5 \
-Wall \
-Wextra \
-Wshadow \
-Wnon-virtual-dtor \
-Wold-style-cast \
-Wcast-align \
-Wunused \
-Woverloaded-virtual \
-Wpedantic \
-Wconversion \
-Wsign-conversion \
-Wnull-dereference \
-Wdouble-promotion \
-Wformat=2 \
-Wsuggest-override \
-Wmisleading-indentation \
-Werror \
-fsanitize=address \
-fsanitize=undefined,bounds \
-fno-sanitize-recover=undefined,bounds \
-fno-omit-frame-pointer \
-std=c++20 \
-Winvalid-pch \
-fpch-instantiate-templates \
-Xclang \
-emit-pch \
-Xclang \
-include \
-Xclang \
/workspaces/cmake-general/tests/project/build/linux-clang-libc++/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx \
-x \
c++-header \
-MD \
-MT \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch \
-MF \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch.d \
-o \
src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.pch \
-c \
/workspaces/cmake-general/tests/project/build/linux-clang-libc++/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx.cxx
it does not find includes
/workspaces/cmake-general/tests/project/build/linux-clang-libc++/src/cli/CMakeFiles/cli.dir/cmake_pch.hxx:5:10:
error: 'iostream' file not found [clang-diagnostic-error]
Both compiler invocations are nearly identica except for path and -stdlib
But also by changing the failing one to libstdc++
it does not work, which is utterly strange?
I am out of luck, how can I debug further here?
It seem its either a clang-tidy bug, or __run_co_compile
does something weird? System includes should be handled by clang right?
Also compile_commands.json
is generated in the build dir.
Thanks for the help.