I am trying to switch to using REFLEX_GENERATE_DICTIONARY from ROOT_GENERATE_DICTIONARY. The latter seems to work fine, while using the former results in an error that is consistent with a c++ standard mismatch. Namely,
no type named 'string_view' in namespace 'std'
I built ROOT v6.24/00 from source with Python3 and the c++17 standard. From my root-config, I have
Hi @chilgenb ,
and welcome to the ROOT forum! Indeed I don’t think that REFLEX_GENERATE_DICTIONARY is on par with ROOT_GENERATE_DICTIONARY. We usually suggest to use the latter. Why are you trying to switch?
@amadio feel free to chime in if you have more info.
The reason for the switch is to be consistent with common build tools being used by Fermilab experiments/projects, LArSoft for example. These build tools use REFLEX_GENERATE_DICTIONARY, though the reason for this is not entirely clear to me. It would be great if I didn’t have to provide support for using both macros.
We have several experiments relying on REFLEX_GENERATE_DICTIONARY
The error you report is bad - I will need to see why our tests don’t pick this up! I’ll be back, please ping me end of the week if you haven’t heard from me.
I verified that I get the same result with either sequence when using ROOT_GENERATE_DICTIONARY. It appears that going to su changes the c++ standard for the compiler only when using REFLEX_GENERATE_DICTIONARY.
In addition, I find that ROOT_GENERATE_DICTIONARY and REFLEX_GENERATE_DICTIONARY are inconsistent with respect to the write location and naming of the rdict.pcm and .rootmap files.
${CMAKE_LIBRARY_OUTPUT_DIRECTORY} is the default for ROOT_GENERATE_DICTIONARY, while ${CMAKE_BINARY_DIR} is the default for REFLEX_GENERATE_DICTIONARY.
With the dictionary target name, ${DICTIONARY_TARGET_NAME}, the .rootmap file is named ${DICTIONARY_TARGET_NAME}.rootmap with ROOT_GENERATE_DICTIONARY, while it is named ${DICTIONARY_TARGET_NAME}Dict.rootmap with REFLEX_GENERATE_DICTIONARY.
The dictionary will match the standard used to build ROOT. To use a dictionary of C++14 classes, ROOT itself must be built with C++14. Can we make sure that’s the case? It might be that sudo cmake --build . --target install pulls in a different ROOT. You can probably try by doing sudo root -q -e __cplusplus. What’s the output?
$ sudo root -q -e __cplusplus
Warning in <TInterpreter::ReadRootmapFile>: class garana::CaloCluster found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::FSParticle found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::G4Particle found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::GTruth found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::Track found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::Vee found in libG__GaranaDictDict.so is already in libGaranaDict.so
Warning in <TInterpreter::ReadRootmapFile>: class garana::Vertex found in libG__GaranaDictDict.so is already in libGaranaDict.so
------------------------------------------------------------------
| Welcome to ROOT 6.22/06 https://root.cern |
| (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Apr 19 2021, 20:22:00 |
| From tags/v6-22-06@v6-22-06 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
(long) 201103
I am confused, however, how this only happens when I use REFLEX_GENERATE_DICTIONARY.
So you have two ROOT installs. One is accessible to the super user e.g. because it’s in $PATH, the other one to your user; the latter us used when your user builds.
If you were to invoke genreflex yourself, sudo and non-sudo would pick up different binaries. I’m not sure I understand what this has to do with REFLEX_GENERATE_DICTIONARY, other than that it triggers this.
I guess the solution is to make sure that your build uses the ROOT you expect. It would be good if REFLEX_GENERATE_DICTIONARY would be forced to use a given ROOT build, as provided by find_package(ROOT) at configuration time. This seems to be a bug. It’d be great if @bellenot could look at this once he is back!