Error while compiling a Go4(ROOT dependent) project

_ROOT Version:6.28/06
_Platform:Ubuntu 22.04
_Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

Hi everyone,

I am unsure if this is the right place to request help.
But I was trying to compile a Go4 project which is dependent on ROOT, basically to convert list mode files to root files.

However iI am getting the following warnings and errors

~/root_v6.26/install/include/RConfigure.h:30:4: warning: #warning "The C++ standard in this build does not match ROOT configuration (201703L); this might cause unexpected issues" [-Wcpp]
~/root_v6.26/install/include/ROOT/RConfig.hxx:48:4: error: #error "ROOT requires support for C++14 or higher."
   48 | #  error "ROOT requires support for C++14 or higher."
      |    ^~~~~
~root_v6.26/install/include/ROOT/RConfig.hxx:50:5: error: #error "Pass `-std=c++14` as compiler argument."
   50 | #   error "Pass `-std=c++14` as compiler argument."

Can someone help me pin down the cause of the error and help in its resolution? Please let me know for any further details. Thank YOu

Hi,

You are trying to compile ROOT 6.28/06, but in your log one sees ~/root_v6.26/install/ directory.

Do you have other ROOT versions installed?
If yes, can you ensure that none of shell variables like PATH, LD_LIBRARY_PATH, ROOTSYS pointing on this other ROOT version.

And if you have older ROOT (like 6.26), it should be sufficient for recent Go4 versions.
Only for Windows and Mac one need latest Go4 with very recent ROOT - because of web graphics.

Regards,
Sergey

Hi Sergey,
emphasized text
Thanks a lot for your reply.

The directory v6.26 is a result of a lousy convention from my side. Actually, I used git clone to install latest stable version of ROOT. Sorry for the confusion.

I am using single root version 6.28.

Please let me know for further queries. Thanks a lot

Hi,

How you compile ROOT? Which cmake arguments are you using?
For 6.28 it should be like:

cmake -DCMAKE_CXX_STANDARD=17 -Droot7=ON -Dwebgui=ON -Dxrootd=OFF <path_to_sources>
1 Like

HI thanks,

I used all the default cmake arguments except for the custom install prefix.
Thanks a lot for sharing the arguments I will give them a try and see if it works.

Just a very silly question: for -DCMAKE_CXX_STANDARD=17, does gcc version need to be 17 as well? I currently have 11.2.

gcc 11.2 is good enough for c++17.
You can use ROOT build directory for Go4 compilation and running.

1 Like

Thanks for the confirmation.

So, to summarize, I need to run CMake again with the above argument and then make in ROOT build directory followed by Go4 compilation, please correct me if I am wrong,

Thanks a lot for your help

Yes, correct

Thank You. I will try following that.

On a totally different note, I just tried running Go4 on a different machine.
Root 6.24 and gcc 9.4. I was able to compile Go4, but when compiling an analysis code, I get a different error,

Generating root6 dictionary G__SCN.cxx ...
Warning in cling::IncrementalParser::CheckABICompatibility():
  Possible C++ standard library mismatch, compiled with __GLIBCXX__ '20200808'
  Extraction of runtime standard library version was: '20210601'
g++ -c EventUnpackStore.cxx -O2 -fPIC -Wall -DLinux -pthread -std=c++14 -m64 -I/home/utkarsh/root_v6.24.04/root/include -I/home/utkarsh/go4/build/include -I/home/utkarsh/go4/build -std=c++11 -fdiagnostics-color -g -Wno-unused-variable -Wno-unused-but-set-variable -o EventUnpackStore.o 
In file included from /home/utkarsh/root_v6.24.04/root/include/TString.h:29,
                 from /home/utkarsh/root_v6.24.04/root/include/TNamed.h:26,
                 from /home/utkarsh/go4/build/include/TGo4EventElement.h:17,
                 from AIDA_Decay_Event_Store.h:4,
                 from Raw_Event.h:13,
                 from AIDA_Event.h:5,
                 from EventUnpackStore.h:20,
                 from EventUnpackStore.cxx:16:
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:32:37: error: ‘experimental’ in namespace ‘std’ does not name a type
   32 |    using basic_string_view = ::std::experimental::basic_string_view<_CharT,_Traits>;
      |                                     ^~~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:35:12: error: ‘basic_string_view’ does not name a type
   35 |    typedef basic_string_view<char> string_view;
      |            ^~~~~~~~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:36:12: error: ‘basic_string_view’ does not name a type
   36 |    typedef basic_string_view<char16_t> u16string_view;
      |            ^~~~~~~~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:37:12: error: ‘basic_string_view’ does not name a type
   37 |    typedef basic_string_view<char32_t> u32string_view;
      |            ^~~~~~~~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:38:12: error: ‘basic_string_view’ does not name a type
   38 |    typedef basic_string_view<wchar_t> wstring_view;
      |            ^~~~~~~~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:4: warning: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’
   48 |    inline double stod(std::string_view str, size_t *pos)
      |    ^~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:28: error: ‘string_view’ is not a member of ‘std’
   48 |    inline double stod(std::string_view str, size_t *pos)
      |                            ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:28: note: ‘std::string_view’ is only available from C++17 onwards
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:52: error: expected primary-expression before ‘*’ token
   48 |    inline double stod(std::string_view str, size_t *pos)
      |                                                    ^
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:53: error: ‘pos’ was not declared in this scope; did you mean ‘ios’?
   48 |    inline double stod(std::string_view str, size_t *pos)
      |                                                     ^~~
      |                                                     ios
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:48:56: error: expression list treated as compound expression in initializer [-fpermissive]
   48 |    inline double stod(std::string_view str, size_t *pos)
      |                                                        ^
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:65:56: error: ‘std::string_view’ has not been declared
   65 | inline std::string &operator+=(std::string &left, std::string_view right)
      |                                                        ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx: In function ‘std::string& std::__ROOT::operator+=(std::string&, int)’:
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:67:29: error: request for member ‘data’ in ‘right’, which is of non-class type ‘int’
   67 |    return left.append(right.data(), right.size());
      |                             ^~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:67:43: error: request for member ‘size’ in ‘right’, which is of non-class type ‘int’
   67 |    return left.append(right.data(), right.size());
      |                                           ^~~~
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx: At global scope:
/home/utkarsh/root_v6.24.04/root/include/ROOT/RStringView.hxx:84:17: error: expected type-specifier
   84 |        operator std::string_view() const { return std::string_view(fData,fLength); }
      |                 ^~~
In file included from /home/utkarsh/root_v6.24.04/root/include/TNamed.h:26,
                 from /home/utkarsh/go4/build/include/TGo4EventElement.h:17,
                 from AIDA_Decay_Event_Store.h:4,
                 from Raw_Event.h:13,
                 from AIDA_Event.h:5,
                 from EventUnpackStore.h:20,
                 from EventUnpackStore.cxx:16:
/home/utkarsh/root_v6.24.04/root/include/TString.h:115:13: error: expected type-specifier
  115 |    operator std::string_view() const { return std::string_view(Data(),fExtent); }
      |             ^~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:280:32: error: ‘string_view’ in namespace ‘std’ does not name a type
  280 |    explicit TString(const std::string_view &sub);
      |                                ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:280:27: note: ‘std::string_view’ is only available from C++17 onwards
  280 |    explicit TString(const std::string_view &sub);
      |                           ^~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:317:37: error: ‘string_view’ in namespace ‘std’ does not name a type
  317 |    TString    &operator=(const std::string_view &s);
      |                                     ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:317:32: note: ‘std::string_view’ is only available from C++17 onwards
  317 |    TString    &operator=(const std::string_view &s);
      |                                ^~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:444:9: error: ‘string_view’ in namespace ‘std’ does not name a type
  444 |    std::string_view View() const { return std::string_view(GetPointer(),Length()); }
      |         ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:444:4: note: ‘std::string_view’ is only available from C++17 onwards
  444 |    std::string_view View() const { return std::string_view(GetPointer(),Length()); }
      |    ^~~
In file included from /home/utkarsh/root_v6.24.04/root/include/TNamed.h:26,
                 from /home/utkarsh/go4/build/include/TGo4EventElement.h:17,
                 from AIDA_Decay_Event_Store.h:4,
                 from Raw_Event.h:13,
                 from AIDA_Event.h:5,
                 from EventUnpackStore.h:20,
                 from EventUnpackStore.cxx:16:
/home/utkarsh/root_v6.24.04/root/include/TString.h:839:53: error: ‘string_view’ in namespace ‘std’ does not name a type
  839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
      |                                                     ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:839:48: note: ‘std::string_view’ is only available from C++17 onwards
  839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
      |                                                ^~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:839:15: error: ‘Bool_t operator==(const char*, const int&)’ must have an argument of class or enumerated type
  839 | inline Bool_t operator==(const char *s1, const std::string_view &s2)
      |               ^~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:844:37: error: ‘string_view’ in namespace ‘std’ does not name a type
  844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
      |                                     ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:844:32: note: ‘std::string_view’ is only available from C++17 onwards
  844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
      |                                ^~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:844:15: error: ‘Bool_t operator==(const int&, const char*)’ must have an argument of class or enumerated type
  844 | inline Bool_t operator==(const std::string_view &s1, const char *s2)
      |               ^~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:857:37: error: ‘string_view’ in namespace ‘std’ does not name a type
  857 |   std::string printValue(const std::string_view* val);
      |                                     ^~~~~~~~~~~
/home/utkarsh/root_v6.24.04/root/include/TString.h:857:32: note: ‘std::string_view’ is only available from C++17 onwards
  857 |   std::string printValue(const std::string_view* val);
      |                                ^~~
make: *** [/home/utkarsh/go4/build/Makefile.rules:50: EventUnpackStore.o] Error 1
utkarsh@utkarsh-Inspiron-14-5408:~/Documents/ms theisis project/Thorium_SINP_GSI/SonOfOdin2021_despec

Can you please share your inputs here as to what is going wrong, thanks a lot.

This is indication that you have different ROOT version installed on the system.
Please check and remove it.

Okay, thanks for your reply, actually this is from a different computer. I will, however check and remove it.

Hi @linev ,
I compiled root using the c++ 17 argument as confirmed by

-pthread -std=c++17 -m64 -I/home/frena_storage/akashrup/root_v6.26/install/include

However, I am still seeing the same issue when compiling the project.

I suspect the Go4 is built using a different compiler standard. Is there a way to check this for Go4?

Thanks a lot !

Hi,

go4 always reuse compiler flags from ROOT.
In your case you see warnings coming from ROOT dictionary generation and
it indicates that ROOT binaries build with other glibc.

Most probably, you have older ROOT installed in default locations like /usr/bin and /usr/lib64

Can you start new shell and call: which root-config if any ROOT installation is around.

Hi these are the commands.

which root-config
>>>~/root_v6.26/install/bin/root-config

echo $ROOTSYS
>>>~/root_v6.26/install

Means you have this version in the paths - which make it very difficult to compile go4 with any other ROOT version.

1 Like

Just one more input I can run and compile all the examples provided by Go4 and see the test.lmd as root.

The makefile of the analysis project has a line

CXXFLAGS += -std=c++11 -fdiagnostics-color -g -Wno-unused-variable -Wno-unused-but-set-variable

Can this lead to issue ?

Thanks a lot for all your help and assiatnec

Yes, you try to redefine c++ standard.

Please remove -std=c++11 from the makefile. Also -g required only for debugging.

1 Like

Ok Thanks for your input Ill try that and share