From 1c44e505cf118fc8424942e783da455c6b0b7134 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:13:51 +0200 Subject: [PATCH] Drop system headers from cling command line Avoid mixing XCode 27 includes with the cling ones. --- core/dictgen/src/rootcling_impl.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/dictgen/src/rootcling_impl.cxx b/core/dictgen/src/rootcling_impl.cxx index e2352b8fe4337..2df77178d3093 100644 --- a/core/dictgen/src/rootcling_impl.cxx +++ b/core/dictgen/src/rootcling_impl.cxx @@ -4047,8 +4047,15 @@ int RootClingMain(int argc, for (const std::string &PPUndefine : gOptPPUndefines) clingArgs.push_back(std::string("-U") + PPUndefine); - for (const std::string &IncludePath : gOptIncludePaths) - clingArgs.push_back(std::string("-I") + llvm::sys::path::convert_to_slash(IncludePath)); + for (const std::string &IncludePath : gOptIncludePaths) { + // Do not promote compiler default include directories (e.g. the macOS SDK's + // usr/include, which find_package(ZLIB) reports) to -I: they would then be + // searched before clang's resource directory, and be stored in the + // dictionary payload for the runtime interpreter to do the same. + if (std::find(gOptCompDefaultIncludePaths.begin(), gOptCompDefaultIncludePaths.end(), IncludePath) + == gOptCompDefaultIncludePaths.end()) + clingArgs.push_back(std::string("-I") + llvm::sys::path::convert_to_slash(IncludePath)); + } for (const std::string &IncludePath : gOptSysIncludePaths) { // Prevent mentioning compiler default include directories as -isystem