Re: Compiling ROOT "test" programs on Linux (fwd)

From: Andre C. McNeill (mac@physics.purdue.edu)
Date: Fri May 28 1999 - 23:19:49 MEST


It already has the -fno_rtti flag in my Makefile.  Does it make a
difference that in my uname -a it has "i686"?  Perhaps I have a messed up
version of Linux?  Let me know, below is my Makefile
______________________________________________________________________________
ObjSuf        = o
SrcSuf        = cxx
ExeSuf        =
DllSuf        = so
EVENTLIB      = $(EVENTO)
OutPutOpt     = -o

ROOTLIBS      = -L$(ROOTSYS)/lib -lNew -lBase -lCint -lClib -lCont -lFunc \
                -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta -lMinuit -lNet \
                -lPostscript -lProof -lTree -lUnix -lZip
ROOTGLIBS     = -lGpad -lGui -lGX11 -lX3d

# Linux with egcs
CXX           = g++
CXXFLAGS      = -O -Wall -fno-rtti -fno-exceptions -fPIC -I$(ROOTSYS)/include
LD            = g++
LDFLAGS       = -g
SOFLAGS       = -shared
LIBS          = $(ROOTLIBS) -lm -ldl -rdynamic
GLIBS         = $(ROOTLIBS) $(ROOTGLIBS) -L/usr/X11R6/lib \
                -lXpm -lX11 -lm -ldl -rdynamic


#------------------------------------------------------------------------------

EVENTO        = Event.$(ObjSuf) \
                EventDict.$(ObjSuf)

EVENTS        = Event.$(SrcSuf) \
                EventDict.$(SrcSuf)

MAINEVENTO    = MainEvent.$(ObjSuf)
MAINEVENTS    = MainEvent.$(SrcSuf)

EVENT         = Event$(ExeSuf)
EVENTSO       = libEvent.$(DllSuf)

HWORLDO       = hworld.$(ObjSuf)
HWORLDS       = hworld.$(SrcSuf)
HWORLD        = hworld$(ExeSuf)

HSIMPLEO      = hsimple.$(ObjSuf)
HSIMPLES      = hsimple.$(SrcSuf)
HSIMPLE       = hsimple$(ExeSuf)

MINEXAMO      = minexam.$(ObjSuf)
MINEXAMS      = minexam.$(SrcSuf)
MINEXAM       = minexam$(ExeSuf)

TSTRINGO      = tstring.$(ObjSuf)
TSTRINGS      = tstring.$(SrcSuf)
TSTRING       = tstring$(ExeSuf)

TCOLLEXO      = tcollex.$(ObjSuf)
TCOLLEXS      = tcollex.$(SrcSuf)
TCOLLEX       = tcollex$(ExeSuf)

TCOLLBMO      = tcollbm.$(ObjSuf)
TCOLLBMS      = tcollbm.$(SrcSuf)
TCOLLBM       = tcollbm$(ExeSuf)

VVECTORO      = vvector.$(ObjSuf)
VVECTORS      = vvector.$(SrcSuf)
VVECTOR       = vvector$(ExeSuf)

VMATRIXO      = vmatrix.$(ObjSuf)
VMATRIXS      = vmatrix.$(SrcSuf)
VMATRIX       = vmatrix$(ExeSuf)

VLAZYO        = vlazy.$(ObjSuf)
VLAZYS        = vlazy.$(SrcSuf)
VLAZY         = vlazy$(ExeSuf)

GUITESTO      = guitest.$(ObjSuf)
GUITESTS      = guitest.$(SrcSuf)
GUITEST       = guitest$(ExeSuf)

HELLOO        = Hello.$(ObjSuf) HelloDict.$(ObjSuf)
HELLOS        = Hello.$(SrcSuf) HelloDict.$(SrcSuf)
HELLOSO       = Hello.$(DllSuf)

ACLOCKO       = Aclock.$(ObjSuf) AclockDict.$(ObjSuf)
ACLOCKS       = Aclock.$(SrcSuf) AclockDict.$(SrcSuf)
ACLOCKSO      = Aclock.$(DllSuf)

TETRISO       = Tetris.$(ObjSuf) TetrisDict.$(ObjSuf)
TETRISS       = Tetris.$(SrcSuf) TetrisDict.$(SrcSuf)
TETRISSO      = Tetris.$(DllSuf)

STRESSO       = stress.$(ObjSuf)
STRESSS       = stress.$(SrcSuf)
STRESS        = stress$(ExeSuf)

OBJS          = $(EVENTO) $(MAINEVENTO) $(HWORLDO) $(HSIMPLEO) $(MINEXAMO) \
                $(TSTRINGO) $(TCOLLEXO) $(VVECTORO) $(VMATRIXO) $(VLAZYO) \
                $(GUITESTO) $(HELLOO) $(ACLOCKO) $(TETRISO) $(STRESSO)

PROGRAMS      = $(EVENT) $(HWORLD) $(HSIMPLE) $(MINEXAM) $(TSTRING) \
                $(TCOLLEX) $(VVECTOR) $(VMATRIX) $(VLAZY) $(GUITEST) \
                $(HELLOSO) $(ACLOCKSO) $(TETRISSO) $(STRESS)

all:            $(PROGRAMS)

$(EVENT):       $(EVENTO) $(MAINEVENTO)
		$(LD) $(SOFLAGS) $(LDFLAGS) $(EVENTO) $(OutPutOpt) $(EVENTSO)
		$(LD) $(LDFLAGS) $(MAINEVENTO) $(EVENTLIB) $(LIBS) $(OutPutOpt) $(EVENT)
		@echo "$(EVENT) done"

$(HWORLD):      $(HWORLDO)
		$(LD) $(LDFLAGS) $(HWORLDO) $(GLIBS) $(OutPutOpt) $(HWORLD)
		@echo "$(HWORLD) done"

$(HSIMPLE):     $(HSIMPLEO)
		$(LD) $(LDFLAGS) $(HSIMPLEO) $(LIBS) $(OutPutOpt) $(HSIMPLE)
		@echo "$(HSIMPLE) done"

$(MINEXAM):     $(MINEXAMO)
		$(LD) $(LDFLAGS) $(MINEXAMO) $(LIBS) $(OutPutOpt) $(MINEXAM)
		@echo "$(MINEXAM) done"

$(TSTRING):     $(TSTRINGO)
		$(LD) $(LDFLAGS) $(TSTRINGO) $(LIBS) $(OutPutOpt) $(TSTRING)
		@echo "$(TSTRING) done"

$(TCOLLEX):     $(TCOLLEXO)
		$(LD) $(LDFLAGS) $(TCOLLEXO) $(LIBS) $(OutPutOpt) $(TCOLLEX)
		@echo "$(TCOLLEX) done"

$(TCOLLBM):     $(TCOLLBMO)
		$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt) $@
		@echo "$@ done"

$(VVECTOR):     $(VVECTORO)
		$(LD) $(LDFLAGS) $(VVECTORO) $(LIBS) $(OutPutOpt) $(VVECTOR)
		@echo "$(VVECTOR) done"

$(VMATRIX):     $(VMATRIXO)
		$(LD) $(LDFLAGS) $(VMATRIXO) $(LIBS) $(OutPutOpt) $(VMATRIX)
		@echo "$(VMATRIX) done"

$(VLAZY):       $(VLAZYO)
		$(LD) $(LDFLAGS) $(VLAZYO) $(LIBS) $(OutPutOpt) $(VLAZY)
		@echo "$(VLAZY) done"

$(GUITEST):     $(GUITESTO)
		$(LD) $(LDFLAGS) $(GUITESTO) $(GLIBS) $(OutPutOpt) $(GUITEST)
		@echo "$(GUITEST) done"

$(STRESS):      $(STRESSO) $(EVENT)
		$(LD) $(LDFLAGS) $(STRESSO) $(EVENTLIB) $(GLIBS) $(OutPutOpt) $(STRESS)
		@echo "$(STRESS) done"

$(HELLOSO):     $(HELLOO)
		$(LD) $(SOFLAGS) $(LDFLAGS) $(HELLOO) $(OutPutOpt) $(HELLOSO)

$(ACLOCKSO):    $(ACLOCKO)
		$(LD) $(SOFLAGS) $(LDFLAGS) $(ACLOCKO) $(OutPutOpt) $(ACLOCKSO)

$(TETRISSO):    $(TETRISO)
		$(LD) $(SOFLAGS) $(LDFLAGS) $(TETRISO) $(OutPutOpt) $(TETRISSO)

clean:
		@rm -f $(OBJS) *Dict.* core

.SUFFIXES: .$(SrcSuf)

###

Event.$(ObjSuf): Event.h
MainEvent.$(ObjSuf): Event.h

EventDict.$(SrcSuf): Event.h EventLinkDef.h
	@echo "Generating dictionary EventDict..."
	@$(ROOTSYS)/bin/rootcint -f EventDict.$(SrcSuf) -c Event.h EventLinkDef.h

Hello.$(ObjSuf): Hello.h
HelloDict.$(SrcSuf): Hello.h
	@echo "Generating dictionary HelloDict..."
	@$(ROOTSYS)/bin/rootcint -f HelloDict.$(SrcSuf) -c Hello.h

Aclock.$(ObjSuf): Aclock.h
AclockDict.$(SrcSuf): Aclock.h
	@echo "Generating dictionary AclockDict..."
	@$(ROOTSYS)/bin/rootcint -f AclockDict.$(SrcSuf) -c Aclock.h

Tetris.$(ObjSuf): Tetris.h
TetrisDict.$(SrcSuf): Tetris.h
	@echo "Generating dictionary TetrisDict..."
	@$(ROOTSYS)/bin/rootcint -f TetrisDict.$(SrcSuf) -c Tetris.h

.$(SrcSuf).$(ObjSuf):
	$(CXX) $(CXXFLAGS) -c $<

______________________________________________________________________________



On Fri, 28 May 1999, Pasha Murat wrote:

> 
> Hi Andre - I guess you need to use `-fno_rtti' flag when compiling your code. 
> Search ROOT Web site for `rtti'.
> 
> Fons and  Rene: it looks like people are asking the same question again and 
> again so it might make sense to fix section "Compiling and Linking with the 
> ROOT libraries" (in http://root.cern.ch/root/Availability.html) to
> specify all the necessary compiler flags in there(first of all - 
> for Linux).
> 				What do you think? -Pasha
> --------------------------------------------------------------------------------
> Andre C. McNeill writes:
>  > 
>  > Peace, I am trying to compile the "test" progams in the test directory
>  > with gmake, under the Linux operating system, and these are the errors it
>  > gives me
>  > 
>  > ______________________________________________________________________________
>  > 
>  > > gmake
>  > g++ -shared -g Event.o EventDict.o -o libEvent.so
>  > g++ -g MainEvent.o Event.o EventDict.o -L/home/andre/root/lib -lNew -lBase
>  > -lCint -lClib -lCont -lFunc -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta
>  > -lMinuit -lNet -lPostscript -lProof -lTree -lUnix -lZip -lm -ldl -rdynamic
>  > -o Event
>  > MainEvent.o: In function `main':
>  > MainEvent.o(.text+0x263): undefined reference to `TFile::TFile(char const
>  > *, char const *, char const *, int)'
>  > MainEvent.o(.text+0x476): undefined reference to `TFile::TFile(char const
>  > *, char const *, char const *, int)'
>  > MainEvent.o(.text+0x51e): undefined reference to
>  > `TDirectory::TDirectory(char const *, char const *, char const *)'
>  > /home/andre/root/lib/libBase.so: undefined reference to `__log1p'
>  > collect2: ld returned 1 exit status
>  > gmake: *** [Event] Error 1
>  > ______________________________________________________________________________
>  > 
>  > Can anyone explain why it is not recognizing the TFile or TDirectory
>  > declarations from the TDirectory.h in the MainEvent.cxx file?
>  > 
>  > Thank you for your time.  Peace.
>  > 
>  > Andre McNeill
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:33 MET