CXX Modules Clang-tidy Linux
@ben.boeckel Continuing the conversation
On Linux with Clang and Ninja there seems to be an issue where clang-tidy is run before the modmap is produced. If I execute the build a second time it succeeds. Cmake 3.29, Clang 18.1.2, Ninja 1.11.1 (In a container/devcontainer on github and locally using vscode)
[14/30] /usr/local/lib/python3.12/dist-packages/cmake/data/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-extra-arg=-Wno-ignored-optimization-argument;-extra-arg=-Wno-unused-command-line-argument;-p;-extra-arg=-std=c++23;--extra-arg-before=--driver-mode=g++" --cppcheck="/usr/bin/cppcheck;--template=gcc;--enable=style,performance,warning,portability;--inline-suppr;--suppress=cppcheckError;--suppress=internalAstError;--suppress=unmatchedSuppression;--suppress=passedByValue;--suppress=syntaxError;--suppress=preprocessorErrorDirective;--inconclusive;--std=c++20" --source=/__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample/Sample/Sample.cpp -- /usr/bin/clang++ -DSAMPLE_STATIC_DEFINE -D_GLIBCXX_ASSERTIONS -I/__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample -I/__w/CmakeCppTemplate/CmakeCppTemplate/_Out/build/Linux-Clang-Ninja-Debug/Projects/Sample -I/__w/CmakeCppTemplate/CmakeCppTemplate/_Out/build/Linux-Clang-Ninja-Debug/Projects/Config -isystem /__w/CmakeCppTemplate/CmakeCppTemplate/_Out/vcpkg_installed/x64-linux/include -g -std=c++23 -flto=thin -fvisibility=hidden -fcolor-diagnostics -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection -fstack-clash-protection -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -fsanitize=address,undefined -MD -MT Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o -MF Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o.d @Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o.modmap -o Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o -c /__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample/Sample/Sample.cpp
FAILED: Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o
/usr/local/lib/python3.12/dist-packages/cmake/data/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-extra-arg=-Wno-ignored-optimization-argument;-extra-arg=-Wno-unused-command-line-argument;-p;-extra-arg=-std=c++23;--extra-arg-before=--driver-mode=g++" --cppcheck="/usr/bin/cppcheck;--template=gcc;--enable=style,performance,warning,portability;--inline-suppr;--suppress=cppcheckError;--suppress=internalAstError;--suppress=unmatchedSuppression;--suppress=passedByValue;--suppress=syntaxError;--suppress=preprocessorErrorDirective;--inconclusive;--std=c++20" --source=/__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample/Sample/Sample.cpp -- /usr/bin/clang++ -DSAMPLE_STATIC_DEFINE -D_GLIBCXX_ASSERTIONS -I/__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample -I/__w/CmakeCppTemplate/CmakeCppTemplate/_Out/build/Linux-Clang-Ninja-Debug/Projects/Sample -I/__w/CmakeCppTemplate/CmakeCppTemplate/_Out/build/Linux-Clang-Ninja-Debug/Projects/Config -isystem /__w/CmakeCppTemplate/CmakeCppTemplate/_Out/vcpkg_installed/x64-linux/include -g -std=c++23 -flto=thin -fvisibility=hidden -fcolor-diagnostics -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection -fstack-clash-protection -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Wimplicit-fallthrough -fsanitize=address,undefined -MD -MT Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o -MF Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o.d @Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o.modmap -o Projects/Sample/CMakeFiles/Sample.dir/Sample/Sample.cpp.o -c /__w/CmakeCppTemplate/CmakeCppTemplate/Projects/Sample/Sample/Sample.cpp
error: no such file or directory: '@Projects/Sample/CMakeFiles/SampleFuzzer.dir/Sample/Sample.cpp.o.modmap' [clang-diagnostic-error]*
Either the order is wrong or there is a race between prducing the file and running clang-tidy (is it even possible?) I mention the race because, I don't have a linux machine, but I am building the linux build using a devcontainer using vscode or on Github using the same container image as locally). I don't know if using a docker/container can have an effect on the responsivness of the filesystem.