Re: Problem compiling a program under mac os X

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Tue, 22 Mar 2005 07:28:44 +0100 (MET)


Francesco,

Version 4.0 is not supported on MAC. Move to 4.03 if you want to get help.

Rene Brun

On Tue, 22
Mar 2005, Francesco Perfetto wrote:

> Hello all,
>
> in these weeks I'm migrating also to mac os system.
> I am new to use root under mac os (I have up to this time used root on
> linux and unix solaris machines).
>
> I have installed root 4.00/06 with fink commander on powerbook with mac
> os 10.3 (I have installed Developer tools too and more...).
>
> I have the following problems:
> 1) When I run root at terminal prompt I have :
>
> nbkloe:~ francesco$ root
> Wait... launching X11.....
> .... done
> Warning in <TEnvRec::ChangeValue>: duplicate entry
> <Library.TMCParticle=libEGPythia6.so libEG.so libGraf.so> for level 0;
> ignored
>
> is this a problem?
> How can I remove it?
>
> 2) Now I woul'd like to run my programs (that I use under Linux and
> SunOS) also under my new computer (with mac os X), but when I do this
> after compilation (compilation NO PROBLEM) I have:
>
> nbkloe:~/LLHOOD_nuovometodo/val-06 francesco$ Darwin/Likelihood.exe
> Fatal in <TFile::TFile>: ROOT system not initialized
> aborting
> Abort trap
>
> There is anyone that can help me ?
>
> my program are (only a portion how example):
>
> 1) Likelihood.cpp:
>
> #include <iostream.h>
> #include "TROOT.h"
> #include "TObject.h"
> void llhood(Double_t ALFA);
>
> int main(int argc, char* argv[])
> {
> double ALFA[] = {0.};
> for(Int_t i=0; i<1; i++){
> llhood(ALFA[i]);
> }
> return 0;
> }
> 2) likelihood.cc:
>
> #define res_class_cxx
> #include "res_class.h"
> #include <iostream.h>
> #include "TH1.h"
> #include "TFile.h"
> #include "TChain.h"
>
> // GLOBAL VARIABLES THAT I MUST USE IN THE FUNCTION IN likelihood.cc
> TFile *f2 = new TFile("PROVA.root");
> TH1D *gen = new TH1D("gen" ,"gen" ,30,0,1);
> ....
> void fcnllhood(...)
> {
> .......
> }
>
> void llhood(Double_t ALFA)
> {
> cout<<"SONO IN llhood\n"<<endl;
>
> gen ->Sumw2();
> ....
> TChain *t = new
> TChain("~/LLHOOD_nuovometodo/val06/bunch_4_minuit.root/res");
> t->Add("~/LLHOOD_nuovometodo/val06/bunch_4_minuit.root/res");
> ....
> res_class *resc = new res_class(t);
>
> Int_t nentries = Int_t(t->GetEntries());
> Int_t nbytes = 0, nb = 0;
>
> cout<<nentries<<endl;
>
> for (Int_t jentry=0; jentry<nentries; jentry++) {
> Int_t ientry = resc->LoadTree(jentry);
> nb = resc->GetEntry(jentry);
> nbytes += nb;
> cout<<"entries = "<<jentry<<endl;
> ....
> gen->Fill(resc->daliz_gen);
> }
> ....
> gen -> Reset();
> }
>
> and this is the makefile that I have modifies to use on mac os:
>
> SISTEMA_OPERATIVO = $(shell uname -s)
>
> ROOTCFLAGS = $(shell /sw/bin/root-config --cflags)
> ROOTLIBS = $(shell /sw/bin/root-config --libs)
> ROOTGLIBS = $(shell /sw/bin/root-config --glibs)
>
> ifeq ($(SISTEMA_OPERATIVO),Linux)
> CXX = g++
> CXXFLAGS = -g $(ROOTCFLAGS)
> DEPEND = $(CXX) -MM
> DEL = rm -rf
>
> LD = g++
> LDFLAGS = -O3 $(ROOTLIBS) -lMinuit
> endif
>
> ifeq ($(SISTEMA_OPERATIVO),SunOS)
> ...
> endif
>
> ####THIS IS THE PORTION I HAVE ADD
> ifeq ($(SISTEMA_OPERATIVO),Darwin)
> CXX = g++
> CXXFLAGS = -g -O -pipe -Wall -W -Woverloaded-virtual $(ROOTCFLAGS)
> DEPEND = $(CXX) -MM
> DEL = rm -rf
>
> LD = g++
> LDFLAGS = -O4 -O -Xlinker -bind_at_load -flat_namespace $(ROOTLIBS)
> -lMinuit
> endif
>
> SOURCES := $(wildcard *.cc)
> OBJECTS := $(SISTEMA_OPERATIVO)/$(SOURCES:.cc=.o)
> EXESRC := $(wildcard *.cpp)
> EXECUTABLES := $(SISTEMA_OPERATIVO)/$(EXESRC:.cpp=.exe)
>
> all: $(EXECUTABLES)
>
> $(SISTEMA_OPERATIVO)/%.exe : %.cpp $(OBJECTS); ${LD} $(CXXFLAGS) $<
> $(OBJECTS) $(LDFLAGS) -o $@
>
> $(SISTEMA_OPERATIVO)/%.o : %.cc; $(CXX) $(CXXFLAGS) -c $< -o $@
>
> $(SISTEMA_OPERATIVO)/%.d : %.cc; $(DEPEND) $(CXXFLAGS) $< > $@
>
> $(SISTEMA_OPERATIVO)/%.d : %.cpp; $(DEPEND) $(CXXFLAGS) $< > $@; sed
> s/.o:/.exe:/g $@ >tmp.sed; mv tmp.sed $@
>
> clean: ; $(DEL) $(SISTEMA_OPERATIVO)/*.d; $(DEL)
> $(SISTEMA_OPERATIVO)/*.o; $(DEL) $(SISTEMA_OPERATIVO)/*.exe
>
> include $(SISTEMA_OPERATIVO)/$(SOURCES:.cc=.d)
> include $(SISTEMA_OPERATIVO)/$(EXESRC:.cpp=.d)
>
> NOTE: the same program run perfectly under Linux RH9.0 with root
> 4.00/04.
>
> Thanks in advance,
> Best regards.
>
> Francesco.
>
Received on Tue Mar 22 2005 - 07:28:50 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET