Hello,
I have made a stand alone executable that writes an event class, that I wrote, to a tree. When writing the class to the tree it has no problem. I can open the root file and see that the information was stored correctly. However, When I try to read the event from the tree it seg faults (that is again in a stand alone executable).
I have tried with and without creating a shared object with no success.
Below is the back trace of the error. It happens when I call tree->GetEntry(0);
I have followed https://root-forum.cern.ch/t/simple-way-to-create-and-merge-shared-libraries/11652/1
in making the associated dictionary’s and linking everything together.
Below below is my make file
Thanks in advance
#0 0x080633b3 in std::__fill_n_a<double*, unsigned int, double> (__first=0x0, __n=3, __value=@0xbfffc8d8) at /usr/include/c++/4.4/bits/stl_algobase.h:758
#1 0x08063363 in std::fill_n<double*, unsigned int, double> (__first=0x0, __n=3, __value=@0xbfffc8d8) at /usr/include/c++/4.4/bits/stl_algobase.h:791
#2 0x080632cc in std::__uninitialized_fill_n<true>::uninitialized_fill_n<double*, unsigned int, double> (__first=0x0, __n=3, __x=@0xbfffc8d8) at /usr/include/c++/4.4/bits/stl_uninitialized.h:204
#3 0x08063223 in std::uninitialized_fill_n<double*, unsigned int, double> (__first=0x0, __n=3, __x=@0xbfffc8d8) at /usr/include/c++/4.4/bits/stl_uninitialized.h:223
#4 0x080630d6 in std::__uninitialized_fill_n_a<double*, unsigned int, double, double> (__first=0x0, __n=3, __x=@0xbfffc8d8) at /usr/include/c++/4.4/bits/stl_uninitialized.h:318
#5 0x08062d71 in std::vector<double, std::allocator<double> >::_M_fill_insert (this=0x8453f40, __position=..., __n=3, __x=@0xbfffc948) at /usr/include/c++/4.4/bits/vector.tcc:397
#6 0x080628be in std::vector<double, std::allocator<double> >::insert (this=0x8453f40, __position=..., __n=3, __x=@0xbfffc948) at /usr/include/c++/4.4/bits/stl_vector.h:851
#7 0x0806243a in std::vector<double, std::allocator<double> >::resize (this=0x8453f40, __new_size=3, __x=0) at /usr/include/c++/4.4/bits/stl_vector.h:557
#8 0x0806e27a in ROOT::TCollectionProxyInfo::Pushback<std::vector<double, std::allocator<double> > >::resize(void*) ()
#9 0x00f17ac3 in TGenCollectionStreamer::ReadPrimitives(int, TBuffer&) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#10 0x00f1ae03 in TGenCollectionStreamer::Streamer(TBuffer&) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#11 0x00ef35c7 in TCollectionStreamer::Streamer(TBuffer&, void*, int, TClass*) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#12 0x00ef4076 in TCollectionClassStreamer::operator()(TBuffer&, void*) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#13 0x0031a016 in TClass::Streamer(void*, TBuffer&, TClass const*) const () from /soft/intel/lucid/root/5.26.00/lib/root/libCore.so.5.26
#14 0x00eef1d7 in TBufferFile::ReadFastArray(void*, TClass const*, int, TMemberStreamer*, TClass const*) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#15 0x00fa9d54 in int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, int, int, int, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libRIO.so.5.26
#16 0x019b0f22 in TBranchElement::ReadLeaves(TBuffer&) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#17 0x019a1442 in TBranch::GetEntry(long long, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#18 0x019a7be2 in TBranchElement::GetEntry(long long, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#19 0x019a7b75 in TBranchElement::GetEntry(long long, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#20 0x019f13b4 in TTree::GetEntry(long long, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#21 0x019be0bc in TChain::GetEntry(long long, int) () from /soft/intel/lucid/root/5.26.00/lib/root/libTree.so.5.26
#22 0x080739ab in main (argc=4, argv=0xbffff474) at NeutronBuilder.C:225
[code]CXX=$(shell root-config --cxx)
CFLAGS=-c -g -Wall $(shell root-config --cflags) -I./src -I ./include
LDLIBS=$(shell root-config --glibs)
LDFLAGS=$(shell root-config --ldflags)
#SOURCES=./src/SL_Event.cc ./src/FileManager.cc ./src/Filter.cc
SOURCES=$(shell ls ./src/.cc)
TEMP=$(shell ls ./src/.cc~)
TEMP2=$(shell ls ./include/*.hh~)
OBJECTS=$(SOURCES:.cc=.o)
MAIN=NeutronBuilder.C
MAINO=./src/NeutronBuilder.o
EXECUTABLE=NeutronBuilder
INCLUDEPATH=include
SRCPATH=src
ROOTCINT=rootcint
DICTNAME = SL_Event
DICTOBJ = $(addsuffix Dictionary.o, $(DICTNAME))
LIBNAME =SL_Event
LIBOBJ = $(addsuffix Lib.so, $(LIBNAME))
.PHONY: clean get put all test sclean
all: $(EXECUTABLE)
$(EXECUTABLE) : $(OBJECTS) $(MAINO) $(LIBOBJ) $(DICTOBJ)
@echo “Building target” $@ “…”
$(CXX) $(LDFLAGS) -o $@ $(OBJECTS)$(DICTOBJ) $(MAINO) $(LDLIBS)
@echo
@echo “Build succeed”
.cc.o:
@echo “Compiling” $< “…”
@$(CXX) $(CFLAGS) $< -o $@
$(MAINO): $(MAIN)
@echo “Compiling” $< “…”
@$(CXX) $(CFLAGS) $< -o $@
%Dictionary.o: include/%.hh src/%LinkDef.h
$(ROOTCINT) -f $(patsubst %.o,%.cc,$@) -c $^;
$(CXX) -p -fPIC $(CFLAGS) -c $(patsubst %.o,%.cc,$@) $(patsubst %.o,%.h,$@)
%Lib.so: %Dictionary.o src/%.o
$(CXX) root-config --cflags
-fPIC -shared -Wl -o $@ $^;
[/code]