Repository navigation
[6.42] [CMake] Only report include dirs known to cling as compiler defaults - #24023
Merged
guitargeek merged 1 commit intoNov 6, 2026
Merged
guitargeek merged 1 commit into
guitargeek merged 1 commit into
Conversation
Since b304aa5 ("Drop system headers from cling command line"), rootcling does not promote compiler default include directories to -I, assuming that cling adds them by itself. Cling, however, only adds the C++ standard library directories (queried from the compiler at startup), its own builtin headers and the system directories that the clang driver adds for the sysroot. The CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES that ROOT reports to rootcling as compiler defaults can contain more than that: the compiler wrappers of Nix or Spack and environment variables like CPATH inject the include directories of all dependencies into the implicit search path of the compiler. Cling does not search these at runtime, so dropping them from the rootcling command line and from the dictionary payload breaks the dictionary generation and the runtime interpreter for headers that include dependency headers, e.g.: REveElement.hxx:27:10: fatal error: 'nlohmann/json.hpp' file not found Only report the directories that cling knows about as compiler default include directories, so that the other ones are still passed as -I: - the C++ standard library directories, - the builtin header directories of the compiler, - the sysroot directories that the clang driver adds, see AddClangSystemIncludeArgs() in clang/lib/Driver/ToolChains/Linux.cpp and Darwin.cpp. The sysroot is CMAKE_SYSROOT, or on macOS the SDK path that CMake resolves from CMAKE_OSX_SYSROOT (which may be empty or a bare SDK name) and passes to the compiler as -isysroot, - the C library directories that the builtin clang is configured with (C_INCLUDE_DIRS), which may not be under the sysroot, e.g. on Nix. 🤖 Done with the help of AI (cherry picked from commit 98cd799)
guitargeek
merged commit Nov 6, 2026
9c3c928
into
root-project:v6-42-00-patches
34 of 37 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #23924, requested by @guitargeek.