Home | News | Documentation | Download

"Undefined Symbol" error while running script in ROOT

_ROOT Version: 6.22/02
_Platform: Centos 7
_Compiler: GCC 10.2.0

Hi All,

I’ve been having issues trying to run a script with root. This code was not written by me though it’s definitely been run successfully before (By someone else on a similar ROOT version, platform, and compiler) so it should be functioning. I’m assuming the problem has to do with either how I’m trying to run the script or that I’m missing something that’s needed by the computer for it to run. It’s hard to tell as I don’t have a lot of experience with this. I’ve looked online for similar solutions but this exact error wasn’t found and none of the similar solutions really helped. If anyone knows what the error is or if I’m doing anything that’s blatantly wrong, I’d be grateful for the help.

I attached the script in question below in addition to a link to a .csv file that’s used by the script. The specific error that’s received is also attached below. Just for reference, six canvases are supposed to be made with the program (Two 2d histograms and four 1d histograms). Aside from setting up the environment, all the steps needed to reproduce this should be alongside the error I attached as well.

[root@phy-nuc Covariance_Related_Scripts]# root draw_strips.cc+
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52                 |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Processing draw_strips.cc+...
cling::DynamicLibraryManager::loadLibrary(): /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so: undefined symbol: _ZN5TROOT14RegisterModuleEPKcPS1_S2_S1_S1_PFvvERKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiESaISD_EES2_b

draw_strips.cc (6.7 KB)

-Jonny

You probably just need to regenerate the library, once. To force that to happen just add a second ‘+’: root draw_strips.cc++. Does that help?

No, I’m still receiving an error though it’s slightly different now that I’ve regenerated the library. From what it seems like, the new " Warning in cling::IncrementalParser::CheckABICompatibility():**" message at least has been addressed before on these forums (One of which I linked below). I have recently updated the compiler similar to the link from GCC version 4.8.5 to GCC 10.2.0. Does this mean I would have to recompile root with the updated compiler? Or is there another approach I can take similar to the solution for the post I linked? Or is this even be the main cause of the problem in the first place?

[root@phy-nuc Covariance_Related_Scripts]# root draw_strips.cc++
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52                 |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Processing draw_strips.cc++...
Info in <TUnixSystem::ACLiC>: creating shared library /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/./draw_strips_cc.so 
 Warning in cling::IncrementalParser::CheckABICompatibility():**
 Possible C++ standard library mismatch, compiled with __GLIBCXX__ '20150623'**
 Extraction of runtime standard library version was: '20200723'**
cling::DynamicLibraryManager::loadLibrary(): /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so: undefined symbol: _ZN5TROOT14RegisterModuleEPKcPS1_S2_S1_S1_PFvvERKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiESaISD_EES2_b
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.o: In function `(anonymous namespace)::TriggerDictionaryInitialization_draw_strips_cc_ACLiC_dict_Impl()':
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.cxx:86: undefined reference to `TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&, char const**, bool)'
collect2: error: ld returned 1 exit status
root [1] .q

There are two problems; yes, the change in GCC might mean you need to also update ROOT. But then the real issue seems to be that root and rootcling (as used by ACLiC - the “++” thing) don’t stem from the same ROOT version?! What does which root, which rootcling show? Can you run root -e 'gDebug=1' draw_strips.cc++ and send the output?

Okay, I’ll be sure to update ROOT after the main issue is addressed then. I attached the two outputs below.

[root@phy-nuc Covariance_Related_Scripts]# which root, which rootcling:

[root@phy-nuc Covariance_Related_Scripts]# which root, which rootcling
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
	/bin/alias
	/usr/bin/which
/usr/bin/which: no root, in (/usr/sue/sbin:/usr/sue/bin:/usr/lib64/qt-3.3/bin:/root/perl5/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin)
/bin/rootcling

[root@phy-nuc Covariance_Related_Scripts]# root -e ‘gDebug=1’ draw_strips.cc++ :

[root@phy-nuc Covariance_Related_Scripts]# root -e 'gDebug=1' draw_strips.cc++
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52                 |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
(int) 1
Processing draw_strips.cc++...
Info in <TUnixSystem::ACLiC>: creating shared library /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/./draw_strips_cc.so
Warning in cling::IncrementalParser::CheckABICompatibility():
  Possible C++ standard library mismatch, compiled with __GLIBCXX__ '20150623'
  Extraction of runtime standard library version was: '20200723'
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libCore.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libHist.so.6.22.02, status 0
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libMatrix.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libGpad.so.6.22.02, status 0
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libGraf.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libCore.so, status 1
cling::DynamicLibraryManager::loadLibrary(): /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so: undefined symbol: _ZN5TROOT14RegisterModuleEPKcPS1_S2_S1_S1_PFvvERKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiESaISD_EES2_b
Info in <TUnixSystem::Load>: loaded library /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so, status -1
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.o: In function `(anonymous namespace)::TriggerDictionaryInitialization_draw_strips_cc_ACLiC_dict_Impl()':
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.cxx:86: undefined reference to `TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&, char const**, bool)'
collect2: error: ld returned 1 exit status
root [2] 

OK thanks. Can you show the output of which root please? And

root -e ‘gDebug=3’ draw_strips.cc++

(Sorry - I should have known that debug level 1 isn’t enough…)

That’s fine, no worries. I attached the output of those two below.

[root@phy-nuc Covariance_Related_Scripts]# which root
/bin/root
[root@phy-nuc Covariance_Related_Scripts]# root -e ‘gDebug=3’ draw_strips.cc++
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52                 |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
ROOT_cli_0:1:1: error: non-ASCII characters are not allowed outside of literals and identifiers
‘gDebug=3’
^
ROOT_cli_0:1:12: error: non-ASCII characters are not allowed outside of literals and identifiers
‘gDebug=3’
         ^
root [1] 

Also, I thought about it and I did run this build script, attached in the link below, to install cling a few days ago (Mostly because of the " cling::DynamicLibraryManager::loadLibrary()" error I mentioned in my original post). I’m not sure if that’s causing the issue of them not stemming from the same ROOT version but I figured it would be worth mentioning. I was still getting my original error before installing it though.

No you totally don’t need to install cling - ROOT has its own.

I don’t know why I failed to type the wrong characters, let me try that again: root -e 'gDebug=3' draw_strips.cc++

Thanks!

Sorry for the wait. I’ll be sure to remove the version of cling that I installed then. The output of root -e 'gDebug=3' draw_strips.cc++ is attached below.

[root@phy-nuc Covariance_Related_Scripts]# root -e 'gDebug=3' draw_strips.cc++
   ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 17 2020, 12:46:52                 |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Info in <TInterpreter::TCling::AutoParse>: Trying to autoparse for cling/Interpreter/RuntimePrintValue.h
Info in <TInterpreter::TCling::AutoLoad>: Trying to autoload for cling/Interpreter/RuntimePrintValue.h
Info in <TInterpreter::TCling::AutoParse>: Starting autoparse for cling/Interpreter/RuntimePrintValue.h

(int) 3
Processing draw_strips.cc++...
Info in <TUnixSystem::ACLiC>: creating shared library /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/./draw_strips_cc.so
Warning in cling::IncrementalParser::CheckABICompatibility():
  Possible C++ standard library mismatch, compiled with __GLIBCXX__ '20150623'
  Extraction of runtime standard library version was: '20200723'
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libCore.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libHist.so.6.22.02, status 0
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libMatrix.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libGpad.so.6.22.02, status 0
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libGraf.so.6.22.02, status 1
Info in <TUnixSystem::Load>: loaded library /usr/lib64/root/libCore.so, status 1
cling::DynamicLibraryManager::loadLibrary(): /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so: undefined symbol: _ZN5TROOT14RegisterModuleEPKcPS1_S2_S1_S1_PFvvERKSt6vectorISt4pairINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiESaISD_EES2_b
Info in <TUnixSystem::Load>: loaded library /home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc.so, status -1
/lib/../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.o: In function `(anonymous namespace)::TriggerDictionaryInitialization_draw_strips_cc_ACLiC_dict_Impl()':
/home/rutca/FEHversion/Ph2_ACF/Covariance_Related_Scripts/draw_strips_cc_ACLiC_dict.cxx:86: undefined reference to `TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > > const&, char const**, bool)'
collect2: error: ld returned 1 exit status
root [2] 

Just a follow up from before. Changing the GCC version back to what it was originally, seems to have fixed the issue I was seeing. Apparently I made a mistake by referring to the previous version as 4.8.5 (It was actually 4.9.2). After running scl enable devtoolset-3 bash (Which switches between versions by setting the default compiler and cmake version to the one from devtoolset-3) the draw_strips.cc script finally started outputting the histograms I was expecting. Thanks for all the help!

1 Like

Phew, good to hear. As there are a myriad way to change the environment, issues with setup are really difficult to track down. Thanks for letting us know.