I use two set object in my root code for the its uniqueness feature. The interpreted version of the code works just fine but when I try to compile it with ACLiC I get a segfault with this possible reason :
"#10 0x00b6e020 in std::_Rb_tree<int, int, std::_Identity, std::less, std::allocator >::insert_unique ()
from /var/autofs/nfs/libcern/linux_glibc2/cern/2010/root.5.26.00.gcc.3.3.5/lib/libCint.so #11 0x02ff0988 in EnergyPerCrystal ()
from /home/ebrard/scripts/microPET/Analysis_cpp.so #12 0x02ff36de in Analysis ()
from /home/ebrard/scripts/microPET/Analysis_cpp.so"
I also have a similar error if compiling with g++. The suspicious piece of code is :
…
set hitcrystals ; // Contains IDs of hit crystal for an event
set detectedevents ; // Contains IDs of detected event for a run
set::iterator at_devent ;
set::iterator at_hitcrystal ;
…
detectedevents.insert(eventID) ;
I am really stuck with that so any help would be appreciate
TCut cut_run = Form("runID == %d",c_run); // Prepare Hits with runID: c_run
Hits->Draw(">>ListHitsByRun",(cut_run),"entrylist") ; //
TEntryList *ListHitsByRun = (TEntryList*)gDirectory->Get("ListHitsByRun"); //
Hits->SetEntryList(ListHitsByRun);
Hits->GetEntry( ListHitsByRun->GetEntry(0) ) ;
c_devent = eventID ;
cout << "BUG" << endl ;
detectedevents.insert(0) ;
// Fast loop over hits for this run to get detected event ID
for(int i = 0 ; i <ListHitsByRun ->GetN() ; i++) {
Hits->GetEntry( ListHitsByRun->GetEntry(i) ) ;
if(eventID != c_devent) {
detectedevents.push_back(eventID) ;
c_devent = eventID ;
}
cout << "BUG RELEASE" << endl ;
…
detectedevents.clear() ;
}
Basically it crashes here because I can see the first “cout” but not the second. The data files are a root file containing a tree and a three columns ascii file stored as three different vectors. I can run this script with cint but there’s no way to get it works in aclic or by compiling with g++. I am not sure what remains of this script is relevant to this issue.
I found the origin of this problem : a conflict version between libstdc++ 5 and 6. My version of Root was compiled with the 5th version whereas g++ and aclic tried to compile with the 6th version. I re-compiled the last version of Root for my local computer and it works now (I previously used a NFS shared version).
2- when compiling with ACLIC, I see unitialized variables:
/home/brun/root/./Analysis.cpp: In function `Double_t interp_charges(Double_t, Double_t, int)':
/home/brun/root/./Analysis.cpp:482: warning: 'i_slopeL' might be used uninitialized in this function
/home/brun/root/./Analysis.cpp:483: warning: 'i_cstL' might be used uninitialized in this function
/home/brun/root/./Analysis.cpp:484: warning: 'i_slopeR' might be used uninitialized in this function
/home/brun/root/./Analysis.cpp:485: warning: 'i_cstR' might be used uninitialized in this function
/home/brun/root/./Analysis.cpp: In function `void EnergyPerCrystal()':
/home/brun/root/./Analysis.cpp:180: warning: 'head' might be used uninitialized in this function
I would suggest to fix these problems first and if your problem persists, post a data file.