Repository navigation
[CMake] Only report include dirs known to cling as compiler defaults - #23924
Merged
guitargeek merged 1 commit intoNov 6, 2026
Merged
Conversation
Test Results 22 files 22 suites 3d 12h 16m 0s ⏱️ For more details on these failures, see this check. Results for commit a74c68d. ♻️ This comment has been updated with latest results. |
guitargeek
added a commit
to guitargeek/nixpkgs
that referenced
this pull request
Nov 2, 2026
…ules workaround Update to the current head of ROOT PR 23877. The fix for the openui5 install rule is part of the PR now. The compiledata.sh and cling include directory fixes were upstreamed as root-project/root@1b6d33beb82 and root-project/root#23924, so fetch them from there instead of carrying local copies. Also apply root-project/root#23923, which generates the Darwin std modulemap from the libc++ of the compiler instead of the one in the SDK. This was the reason for disabling runtime_cxxmodules on Darwin.
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
guitargeek
force-pushed
the
report-include-directories-fix
branch
from
November 3, 2026 16:08
6e3c6df to
a74c68d
Compare
Contributor
Author
|
/backport to 6.42 |
|
Preparing to backport PR #23924 to branch 6.42 requested by guitargeek |
|
This PR has been backported to branch 6.42: #24023 |
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.
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__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:
🤖 Done with the help of AI
Fixes a regression introduced by: