Re: [ROOT] unknown runtime error using gROOT->Reset()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 07 2004 - 08:10:18 MEST


gROOT->Reset() should not be called in a named script or a compiled program.

Rene Brun

Darren Grant wrote:
> 
> Hi
> 
> I have come across an error I dont understand in running some root code.
> I have tried to include the
> 
> gROOT->Reset();
> 
> command in my code.  I compile without errors but when I run the code I
> get the following error:
> 
> *** Break *** segmentation violation
>  Generating stack trace...
>  0x4068b65e in G__scratch_globals_upto + 0x27 from
> /home/dgrant/root/lib/libCint.so
>  0x40176439 in TCint::ResetGlobals() + 0x21 from
> /home/dgrant/root/lib/libCore.so
>  0x4013a698 in TROOT::Reset(char const*) + 0x32 from
> /home/dgrant/root/lib/libCore.so
>  0x08049067 in main + 0x2f from matread
>  0x42015574 in __libc_start_main + 0xe4 from /lib/tls/libc.so.6
>  0x08048f9d in TFile::TFile[in-charge](char const*, char const*, char
> const*, int) + 0x31 from matread
> Abort (core dumped)
> 
> A simplified version of the code is:
> 
> #include <cstdio>
> #include <iostream>
> #include <string>
> #include "TFile.h"
> #include "TTree.h"
> #include "TH2.h"
> #include "TCanvas.h"
> #include "TVector.h"
> #include "TROOT.h"
> #include "TCint.h"
> 
> using namespace std;
> 
> TROOT rootBase("analysis","ROOT analysis environment");
> int main()
> {
> gROOT->Reset();
> TFile *file = new TFile ("test.root", "RECREATE");
> TTree *tree = new TTree ("tree", "Testing");
> 
> }
> 
> And this is compiled with a makefile:
> 
> # Makefile
> #
> ROOTLIBS        =       $(shell root-config --libs) -lMinuit #-lTable
> -lHtml
> ROOTGLIBS       =       $(shell root-config --glibs)
> ROOTINCLUDE     ?=      $(shell root-config --incdir)
> MATLABDIR       =       /data4/dgrant/Matlab_Inst/extern/lib/glnx86
> MATLABD2        =       /data4/dgrant/Matlab_Inst/bin/glnx86
> 
> CXX             =       g++
> CXXFLAGS        =       -O2 -Wall   -fPIC -I$(ROOTINCLUDE)
> 
> OBJS            =       matread.o
> 
> matread: $(OBJS)
>         $(CXX) $(CXXFLAGS) $(ROOTLIBS) $(ROOTGLIBS) -L$(MATLABDIR) -lmat
> -lmx -l
> mmfile -lmwservices -L$(MATLABD2) -lmatlb -lmex -lmwmpath -lmwudd -o $@ $^
> 
> matread.d: matread.cxx
>         @echo "Generating dependency file $@"
>         @set -e; rm -f $@
>         @$(CXX) -M $(CXXFLAGS) $< > $@.tmp
>         @sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@
>         @rm -f $@.tmp
> 
> include matread.d
> 
> matread.o:      matread.cxx matread.h
>         $(CXX) -c $(CXXFLAGS) $<
> 
> clean:
>         rm -f *.o
>         rm -f *.d
> 
> Has anyone come across this before and maybe offer some advice?
> 
> Thanks so much!
> Cheers
> Darren



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET