Skip to content

rootcling appears to ignore -compilerI directives #22421

@Dr15Jones

Description

@Dr15Jones

Check duplicate issues.

  • Checked for duplicates

Description

When building a CMake based package, the cmake configuration of the package explicitly said where to find the compiler (not the system one). The path to the compiler was NOT specified in the PATH environment variable. When it came time for the Cmake package to build a ROOT dictionary, it failed with

In file included from input_line_7:3:
In file included from /uscms_data/d1/cdj/build/temp/muonCollider/stitched/Code4hep/Code4Hep/DataFormats/src/classes.h:1:
In file included from /uscms_data/d1/cdj/build/temp/muonCollider/extern/include/edm4hep/edm4hep.h:6:
/uscms_data/d1/cdj/build/temp/muonCollider/extern/include/podio/utilities/TypeHelpers.h:4:10: fatal error: 'concepts' file not found
#include <concepts>

However, a path to a directory holding that header was set in the call to rootcling using a -compilerI directive.

After changing the option passed to rootcling to use -v4 I noticed the output

cling version ROOT_1.3~dev
Looking for C++ headers with:
  LC_ALL=C g++   -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*++/p' -e '}'
Found:
  /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8
  /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux
  /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward

that was not the correct compiler to use. I then added the path to the correct compiler to PATH and then I got

cling version ROOT_1.3~dev
Looking for C++ headers with:
  LC_ALL=C g++   -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*++/p' -e '}'
Found:
  /cvmfs/cms.cern.ch/el8_amd64_gcc13/external/gcc/13.4.0-6908cfdf803923e783448096ca4f0923/bin/../lib/gcc/x86_64-redhat-linux-gnu/13.4.0/../../../../include/c++/13.4.0
  /cvmfs/cms.cern.ch/el8_amd64_gcc13/external/gcc/13.4.0-6908cfdf803923e783448096ca4f0923/bin/../lib/gcc/x86_64-redhat-linux-gnu/13.4.0/../../../../include/c++/13.4.0/x86_64-redhat-linux-gnu
  /cvmfs/cms.cern.ch/el8_amd64_gcc13/external/gcc/13.4.0-6908cfdf803923e783448096ca4f0923/bin/../lib/gcc/x86_64-redhat-linux-gnu/13.4.0/../../../../include/c++/13.4.0/backward

at that time the code would compile.

Reproducer

Make a simple CMake package that uses ROOT's CMake function to generate dictionaries. Then tell CMake to use a non-system compiler which is not specified in PATH.

ROOT version

6.36.09

Installation method

built from source

Operating system

Linux

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions