Problem on MACOS 10.5 Leopard

Hello,
I have a c++ program which works on SLC4. I tried to compile it on my brand new iMac but I got this error message:

g++ -O -Wall -fPIC -g  -D_REENTRANT -pthread -m64 -I/Users/santocch/myPrograms/root_5.18/include   -c -o partonCalib.o partonCalib.cpp
g++ -O partonCalib.o  -L/Users/santocch/myPrograms/root_5.18/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -pthread -lm -ldl -lEG /Users/santocch/myPrograms/root_5.18/lib/libMinuit.so\
                   -o partonCalib
ld: warning in partonCalib.o, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libCore.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libCint.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libRIO.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libNet.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libHist.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libGraf.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libGraf3d.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libGpad.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libTree.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libRint.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libPostscript.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libMatrix.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libPhysics.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libEG.dylib, file is not of required architecture
ld: warning in /Users/santocch/myPrograms/root_5.18/lib/libMinuit.so, file is not of required architecture
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [partonCalib] Error 1

Any suggestion?
Cheers

Attilio

Do you have a 64 bits Mac? Why do you specify the option “-m64”.
It looks like you copied your compile instructions from SLC4 to Mac.
To see the compile instructions for any machine, do:
root-config --cflags

Hi
it’s not me!
This is the Makefile I’m using:

...
# Programs and flags
CXX           = g++
CXXFLAGS      = -O -Wall -fPIC -g
LD            = g++
LDFLAGS       = -O
SOFLAGS       = -shared

ROOTCFLAGS   := $(shell root-config --cflags)
ROOTLIBS     := $(shell root-config --libs)
MINUPATH     := $(shell root-config --libdir)
...

In fact here is the output of the command you suggested:

root-config --cflags
-D_REENTRANT -pthread -m64 -I/Users/santocch/myPrograms/root_5.18/include

I tried to remove manually the -m64 flag but the error is the same. BTW my machine is a brand new iMAC cpu INTEL core 2 duo at 2.4GHz

Thanks

Attilio

How did you install/configure ROOT?

Rene

I downloaded the src and compiled from scratch… root is working fine (at least for simple things as read histos from file and elaborate them). Is there a logfile of the compilation which could help to understand what’s going on? I just remember that the compilation phase was OK and I didn’t remember any particular error/warning message but I could be wrong.
Thanks

Attilio

Yor are missing -m64 on the link statement:

[code]g++ -O partonCalib.o -L/Users/santocch/myPrograms/root_5.18/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -pthread -lm -ldl -lEG /Users/santocch/myPrograms/root_5.18/lib/libMinuit.so\
-o partonCalib

[/code]

– Fons

YEAH!
That was the problem: now it works.
I have a warning which doesn’t cause problems (at least to me):

g++ -O -Wall -fPIC -g  -D_REENTRANT -pthread -m64 -I/Users/santocch/myPrograms/root_5.18/include   -c -o partonCalib.o partonCalib.cpp
g++ -O partonCalib.o  -L/Users/santocch/myPrograms/root_5.18/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -pthread -lm -ldl -lEG /Users/santocch/myPrograms/root_5.18/lib/libMinuit.so -m64\
                   -o partonCalib
ld: warning in /usr/local/lib/libfreetype.dylib, missing required architecture x86_64 in file
partonCalib done

I guess that the command:

root-config --libs
-L/Users/santocch/myPrograms/root_5.18/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -pthread -lm -ldl

needs to include the -m64 flag.

Thanks for helping.
Ciao

Attilio

Well actually you should use ‘root-config --cflags --libs’. Good it works now.

Cheers, Fons.