Repository: root-project/root

Issue #13101: [CMake] Existing ROOT headers from the system might be picked up when compiling ROOT
Created: 2023-06-26T19:20:23Z
Check duplicate issues.

 Checked for duplicates

Description
Can't install RooFit because of RooJSON.
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx: In member function ‘virtual bool {anonymous}::RooExpPolyStreamer::exportObject(RooJSONFactoryWSTool*, const RooAbsArg*, RooFit::Detail::JSONNode&) const’:
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:448:25: error: ‘const class RooExpPoly’ has no member named ‘x’; did you mean ‘RooRealProxy RooExpPoly::_x’? (not accessible from this context)
  448 |       elem["x"] << pdf->x().GetName();
      |                         ^
In file included from /opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:20:
/opt/root/install/include/RooExpPoly.h:37:17: note: declared protected here
   37 |    RooRealProxy _x;
      |                 ^~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:453:32: error: ‘const class RooExpPoly’ has no member named ‘lowestOrder’; did you mean ‘int RooExpPoly::_lowestOrder’? (not accessible from this context)
  453 |       for (int i = 0; i < pdf->lowestOrder(); ++i) {
      |                                ^~~~~~~~~~~
/opt/root/install/include/RooExpPoly.h:39:8: note: declared protected here
   39 |    int _lowestOrder;
      |        ^~~~~~~~~~~~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:456:36: error: ‘const class RooExpPoly’ has no member named ‘coefList’; did you mean ‘RooListProxy RooExpPoly::_coefList’? (not accessible from this context)
  456 |       for (const auto &coef : pdf->coefList()) {
      |                                    ^~~~~~~~
/opt/root/install/include/RooExpPoly.h:38:17: note: declared protected here
   38 |    RooListProxy _coefList;
      |                 ^~~~~~~~~
make[2]: *** [roofit/hs3/CMakeFiles/RooFitHS3.dir/build.make:132: roofit/hs3/CMakeFiles/RooFitHS3.dir/src/JSONFactories_RooFitCore.cxx.o] Error 1

Tried to change method names to those with underscores, got another error about a protected field:
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx: In member function ‘virtual bool {anonymous}::RooExpPolyStreamer::exportObject(RooJSONFactoryWSTool*, const RooAbsArg*, RooFit::Detail::JSONNode&) const’:
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:448:25: error: ‘RooRealProxy RooExpPoly::_x’ is protected within this context
  448 |       elem["x"] << pdf->_x().GetName();
      |                         ^~
In file included from /opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:20:
/opt/root/install/include/RooExpPoly.h:37:17: note: declared protected here
   37 |    RooRealProxy _x;
      |                 ^~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:448:27: error: no match for call to ‘(const RooRealProxy {aka const RooTemplateProxy<RooAbsReal>}) ()’
  448 |       elem["x"] << pdf->_x().GetName();
      |                    ~~~~~~~^~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:453:32: error: ‘int RooExpPoly::_lowestOrder’ is protected within this context
  453 |       for (int i = 0; i < pdf->_lowestOrder(); ++i) {
      |                                ^~~~~~~~~~~~
/opt/root/install/include/RooExpPoly.h:39:8: note: declared protected here
   39 |    int _lowestOrder;
      |        ^~~~~~~~~~~~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:453:44: error: expression cannot be used as a function
  453 |       for (int i = 0; i < pdf->_lowestOrder(); ++i) {
      |                           ~~~~~~~~~~~~~~~~~^~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:456:36: error: ‘RooListProxy RooExpPoly::_coefList’ is protected within this context
  456 |       for (const auto &coef : pdf->_coefList()) {
      |                                    ^~~~~~~~~
/opt/root/install/include/RooExpPoly.h:38:17: note: declared protected here
   38 |    RooListProxy _coefList;
      |                 ^~~~~~~~~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:456:45: error: no match for call to ‘(const RooListProxy {aka const RooCollectionProxy<RooArgList>}) ()’
  456 |       for (const auto &coef : pdf->_coefList()) {
      |                               ~~~~~~~~~~~~~~^~
make[2]: *** [roofit/hs3/CMakeFiles/RooFitHS3.dir/build.make:132: roofit/hs3/CMakeFiles/RooFitHS3.dir/src/JSONFactories_RooFitCore.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:44184: roofit/hs3/CMakeFiles/RooFitHS3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Commented the body of the whole function. Got another error.
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx: In member function ‘virtual bool {anonymous}::RooExpPolyStreamer::exportObject(RooJSONFactoryWSTool*, const RooAbsArg*, RooFit::Detail::JSONNode&) const’:
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:444:63: warning: unused parameter ‘func’ [-Wunused-parameter]
  444 |    bool exportObject(RooJSONFactoryWSTool *, const RooAbsArg *func, JSONNode &elem) const override
      |                                              ~~~~~~~~~~~~~~~~~^~~~
/opt/root/src/roofit/hs3/src/JSONFactories_RooFitCore.cxx:444:79: warning: unused parameter ‘elem’ [-Wunused-parameter]
  444 |    bool exportObject(RooJSONFactoryWSTool *, const RooAbsArg *func, JSONNode &elem) const override
      |                                                                     ~~~~~~~~~~^~~~
[ 98%] Linking CXX shared library ../../lib/libRooFitHS3.so
/usr/bin/ld: CMakeFiles/RooFitHS3.dir/src/JSONFactories_HistFactory.cxx.o: in function `std::vector<double, std::allocator<double> >& RooFit::Detail::operator<< <double>(std::vector<double, std::allocator<double> >&, RooFit::Detail::JSONNode const&) [clone .isra.0]':
JSONFactories_HistFactory.cxx:(.text+0xc212): undefined reference to `double RooFit::Detail::JSONNode::val_t<double>() const'
collect2: error: ld returned 1 exit status
make[2]: *** [roofit/hs3/CMakeFiles/RooFitHS3.dir/build.make:200: lib/libRooFitHS3.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:44184: roofit/hs3/CMakeFiles/RooFitHS3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Reproducer
Clone ROOT repository, go to the build directory,

cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=../install ../src
cmake --build . -- install -j4

ROOT version
Most recent ROOT version from the master branch at that time.

commit 870618f (HEAD -> master, origin/master, origin/HEAD)

Should I use that? I thought there is continuous integration and people check for errors before committing.
Installation method
built from source
Operating system
Arch Linux
Additional context
Had to remove RooFit support from CMakeCache.txt.

Duplicate issue #13103: can't compile RNTupleDS
Created: 2023-06-26T19:34:09Z
Check duplicate issues.

 Checked for duplicates

Description
When building ROOT from source, I got an error:
/opt/root/src/tree/dataframe/src/RNTupleDS.cxx: In member function ‘virtual const ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations& ROOT::Experimental::Internal::RRDFCardinalityField::GetColumnRepresentations() const’:
/opt/root/src/tree/dataframe/src/RNTupleDS.cxx:78:25: error: ‘kSplitIndex64’ is not a member of ‘ROOT::Experimental::EColumnType’; did you mean ‘kSplitIndex32’?
   78 |          {{EColumnType::kSplitIndex64}, {EColumnType::kIndex64}, {EColumnType::kSplitIndex32}, {EColumnType::kIndex32}},
      |                         ^~~~~~~~~~~~~
      |                         kSplitIndex32
/opt/root/src/tree/dataframe/src/RNTupleDS.cxx:78:55: error: ‘kIndex64’ is not a member of ‘ROOT::Experimental::EColumnType’; did you mean ‘kIndex32’?
   78 |          {{EColumnType::kSplitIndex64}, {EColumnType::kIndex64}, {EColumnType::kSplitIndex32}, {EColumnType::kIndex32}},
      |                                                       ^~~~~~~~
      |                                                       kIndex32
/opt/root/src/tree/dataframe/src/RNTupleDS.cxx:79:12: error: no matching function for call to ‘ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::RColumnRepresentations(<brace-enclosed initializer list>, <brace-enclosed initializer list>)’
   79 |          {});
      |            ^
In file included from /opt/root/src/tree/dataframe/src/RNTupleDS.cxx:19:
/opt/root/install/include/ROOT/RField.hxx:111:7: note: candidate: ‘ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::RColumnRepresentations(const TypesList_t&, const TypesList_t&)’
  111 |       RColumnRepresentations(const TypesList_t &serializationTypes, const TypesList_t &deserializationExtraTypes);
      |       ^~~~~~~~~~~~~~~~~~~~~~
/opt/root/install/include/ROOT/RField.hxx:111:49: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘const ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::TypesList_t&’ {aka ‘const std::vector<std::vector<ROOT::Experimental::EColumnType> >&’}
  111 |       RColumnRepresentations(const TypesList_t &serializationTypes, const TypesList_t &deserializationExtraTypes);
      |                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/opt/root/install/include/ROOT/RField.hxx:110:7: note: candidate: ‘ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::RColumnRepresentations()’
  110 |       RColumnRepresentations();
      |       ^~~~~~~~~~~~~~~~~~~~~~
/opt/root/install/include/ROOT/RField.hxx:110:7: note:   candidate expects 0 arguments, 2 provided
/opt/root/install/include/ROOT/RField.hxx:107:10: note: candidate: ‘ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::RColumnRepresentations(const ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations&)’
  107 |    class RColumnRepresentations {
      |          ^~~~~~~~~~~~~~~~~~~~~~
/opt/root/install/include/ROOT/RField.hxx:107:10: note:   candidate expects 1 argument, 2 provided
/opt/root/install/include/ROOT/RField.hxx:107:10: note: candidate: ‘ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations::RColumnRepresentations(ROOT::Experimental::Detail::RFieldBase::RColumnRepresentations&&)’
/opt/root/install/include/ROOT/RField.hxx:107:10: note:   candidate expects 1 argument, 2 provided
make[2]: *** [tree/dataframe/CMakeFiles/ROOTDataFrame.dir/build.make:524: tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RNTupleDS.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:36193: tree/dataframe/CMakeFiles/ROOTDataFrame.dir/all] Error 2

No header inclusion helped; it's really strange why 32 bit fields from the very same structure (enumeration) are visible, and 64 are not...
Had to comment out

// {EColumnType::kSplitIndex64}, {EColumnType::kIndex64},

Reproducer
Clone ROOT repository, go to the build directory,
cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_INSTALL_PREFIX=../install ../src
cmake --build . -- install -j4

ROOT version
Most recent ROOT version from the master branch at that time.
commit 870618f (HEAD -> master, origin/master, origin/HEAD)
Installation method
built from source
Operating system
Arch Linux
Additional context
Had several problems while installing ROOT from source today (submitted bugs). Hope this is not because of my own system.

Closing comment (2023-06-26T22:38:22Z): Duplicate of #13101.