Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10661

rootcling produces uncompilable dictionary if class depends on boost headers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.18/04, 6.20/04
    • Fix Version/s: 6.22/00
    • Component/s: Cling
    • Labels:
      None
    • Environment:

      Ubuntu 18.04.4 LTS
      gcc version 7.5.0
      boost v1.72.0
      root 6.18/04 or master

      Description

      Hello,

      rootcling writes into the generated dictionary

      namespace std {} using namespace std;
      

      before adding the headers the classes depend on. Adding the std namespace to the global scope lookup leads to compilation errors below (full err.log.gz attached) in case the class header for which the dictionary is generated includes boost 1.72.0 headers (using forward declarations is not always possible):

      g++ -fPIC -std=gnu++1z -g -ggdb -O2 -I/home/shahoian/alice/sw/ubuntu1804_x86-64/ROOT/c5fc2a6169-1/include -I./ -I/home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include -c demoSTDDict.cxx  -o demoSTDDict.o
      In file included from /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram/indexed.hpp:12:0,
                       from /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram/algorithm/empty.hpp:11,
                       from /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram/algorithm.hpp:15,
                       from /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram.hpp:29,
                       from demoSTD.h:5,
                       from demoSTDDict.cxx:41:
      /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram/axis/traits.hpp:325:41: error: return type specified for deduction guide
       constexpr unsigned rank(const Axis& axis) {
                                               ^
      /home/shahoian/alice/sw/ubuntu1804_x86-64/boost/v1.72.0-alice1-1/include/boost/histogram/axis/traits.hpp:325:11: error: decl-specifier in declaration of deduction guide
       constexpr unsigned rank(const Axis& axis) 
                 ^~~~~~~~
      

      Attached demoSTD.tar.gz reproduces the problem (since I am using the boos from Alice O2 bundle, I have its include path explicitly in the Makefile, should be adjusted depending on your test system): running `make` produces the errors I mentioned.

      The problem is trivially fixed by moving the

      namespace std {} using namespace std;
      

      addition after the includes.
      Here is the patch for the root fork used by Alice:
      for root master
      for root v6-18-04

      With this patch both Makefile compilation and macro JIT compilation (root -b -q run_demoSTD.C+ after building the library using the Makefile) proceed w/o errors.

      Best regards,
      Ruben

        Attachments

          Activity

            People

            • Assignee:
              vvasilev Vasil Georgiev Vasilev
              Reporter:
              shahoian Ruben Shahoyan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: