Hi Robert, please make sure that libNew.so is the first of all libs, to do that use "root-config --new --glibs" Cheers, Fons. On Mon, 2004-02-09 at 16:28, Robert Michaels wrote: > Using ROOT 3.05-07 with gcc 3.2.3 on Red Hat Enterprise Linux WS release 3 > and the same problem occurs with ROOT 3.10-02 (same gcc and RedHat). > > My problem is with the following TMapFile example. Although it does work > successfully as a macro run under rootn.exe, the compiled code gives an > error message and does not produce a map file. A similar problem was > reported by Jianglai Liu in roottalk Nov 18, 2003, but with no resolution. > > 1. First, here is what works: > > rootn.exe > root [0] .x hprod.cxx > > (--> Everything fine, the mapfile "hsimple.map" is created and > contains a histogram.) > > 2. Here is what does NOT work -- produces no map file > > ./hprod > Error in <TMapFile::TMapFile>: no memory mapped file capability available > Use rootn.exe or link application against "-lNew" > > (--> But it was linked to lNew, see below. Also $LD_LIBRARY_PATH and > $ROOTSYS are correct.) > > The question is why does the compiled version fail if I did in fact > link against "-lNew" ? Another hint is that on another RH distribution > (RH 8.0 with gcc 3.2.3 and the above versions of ROOT) the compiled code > does successfully run with the same Makefile. So, it may be difficult > to reproduce since it does work on some systems. > > Details: > > Here is the successful macro "hprod.cxx" > > { // macro version (run in rootn.exe) > > // Set the map address as per instructions (using rootn.exe) > // http://root.cern.ch/lxr/source/base/src/TMapFile.cxx#1065 > TMapFile::SetMapAddress(0x41d92000); > > TMapFile* mfile = TMapFile::Create("hsimple.map","RECREATE", 100000, > "Demo memory mapped file with histograms"); > > TH1F* hpx = new TH1F("hpx","This is the px distribution",100,-4,4); > > Float_t px, py; > int ii = 0; > while (1) { > gRandom->Rannor(px,py); > hpx->Fill(px); > if (!(ii % 100)) { > mfile->Update(); > cout << "Update "<<ii<<endl; > } > ii++; > gSystem->Sleep(40); > } > } > > > ---------------- > And here is the source of the compiled code (identical to macro > except for header stuff) > > #include <TROOT.h> > #include <TMapFile.h> > #include <TH1.h> > #include <iostream> > #include <TRandom.h> > #include <TSystem.h> > > using namespace std; > int main() > { > > // Set the map address as per instructions (using rootn.exe) > // http://root.cern.ch/lxr/source/base/src/TMapFile.cxx#1065 > TMapFile::SetMapAddress(0x41d92000); > > TMapFile* mfile = TMapFile::Create("hsimple.map","RECREATE", 100000, > "Demo memory mapped file with histograms"); > > TH1F* hpx = new TH1F("hpx","This is the px distribution",100,-4,4); > > Float_t px, py; > int ii = 0; > while (1) { > gRandom->Rannor(px,py); > hpx->Fill(px); > if (!(ii % 100)) { > mfile->Update(); > cout << "Update "<<ii<<endl; > } > ii++; > gSystem->Sleep(40); > } > } > > > --------------------- > And here is the (simplified) Makefile for the compiled code > > ROOTCFLAGS = $(shell root-config --cflags) > ROOTLIBS = $(shell root-config --libs) > ROOTLIBS += $(ROOTSYS)/lib/libNew.so > ROOTGLIBS = $(shell root-config --glibs) > ROOTGLIBS += $(ROOTSYS)/lib/libNew.so > > CXXFLAGS = -O -Wall -fPIC -I$(ROOTSYS)/include -g > CC = g++ > OPTIM= > CXXFLAGS +=$(ROOTCFLAGS) > LIBS = $(LIBM) $(ROOTLIBS) $(ROOTGLIBS) > hprod: hprod.o > $(CC) $(CXXFLAGS) -o hprod hprod.o $(LIBS) > > > --------------------- > And here is what the compilation says (it seems "-lNew" is linked) > > rm *.o ; make > g++ -O -Wall -fPIC -I/apps/root/3.05-07-gcc3.2.3/root/include -g -D_REENTRANT -I/apps/root/3.05-07-gcc3.2.3/root/include -c hprod.C > g++ -O -Wall -fPIC -I/apps/root/3.05-07-gcc3.2.3/root/include -g -D_REENTRANT -I/apps/root/3.05-07-gcc3.2.3/root/include -o hprod hprod.o -L/apps/root/3.05-07-gcc3.2.3/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lpthread -lm -ldl -rdynamic /apps/root/3.05-07-gcc3.2.3/root/lib/libNew.so -L/apps/root/3.05-07-gcc3.2.3/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGui -lpthread -lm -ldl -rdynamic /apps/root/3.05-07-gcc3.2.3/root/lib/libNew.so > > ---- > thanks ! > Bob Michaels > Jefferson Lab -- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248 WWW: http://www.rademakers.org/fons/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET