Compiling CTFFIND on Mac OSX 10.6.7

Hi,

I have a new Macbook with (i5 quad core intel processor) and OS 10.6.7.
I have gfortran-4.5 and g95 compilers.
I tried to compile the latest ctffind (ctf_101203).
I get the following error:

gfortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
ctffind3.o iof.o ioc.o -o ctffind3.exe
ld: warning: in ctffind3.o, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in iof.o, file was built for i386 which is not the architecture being linked (x86_64)
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [ctffind3.exe] Error 1

Any suggestions how I can get round this problem.

Thanks,

Rene

ps. Below is the makefile I used:

all: ctffind3.exe ctftilt.exe

ctffind3.exe: ctffind3.o iof.o ioc.o
gfortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
ctffind3.o iof.o ioc.o -o ctffind3.exe

ctftilt.exe: ctftilt.o iof.o ioc.o
gfortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
ctftilt.o iof.o ioc.o -o ctftilt.exe
\rm *.o

ctffind3.o: ctffind3.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c ctffind3.f

ctftilt.o: ctftilt.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c ctftilt.f

iof.o: iof.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c iof.f

ioc.o: ioc.c
gcc -O3 -DPROTOTYPE -Dalliant -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -w -c ioc.c
#

In reply to by Axel

Hi Alexis,

It worked! There must have been some files knocking around from my eariler 'blind' attempts at compiling. Thank you for the help.
I followed your command ("rm -f *.o"). I then used the following makefile which uses gfortran4-5:

all: ctffind3.exe ctftilt.exe

ctffind3.exe: ctffind3.o iof.o ioc.o
gfortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
ctffind3.o iof.o ioc.o -o ctffind3.exe

ctftilt.exe: ctftilt.o iof.o ioc.o
gfortran -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
ctftilt.o iof.o ioc.o -o ctftilt.exe
\rm *.o

ctffind3.o: ctffind3.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c ctffind3.f

ctftilt.o: ctftilt.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c ctftilt.f

iof.o: iof.f
gfortran -O3 -s -fomit-frame-pointer -Wall -falign-functions=4 \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-w -c iof.f

ioc.o: ioc.c
gcc -O3 -DPROTOTYPE -Dalliant -D_FILE_OFFSET_BITS=64 \
-D_LARGEFILE_SOURCE -w -c ioc.c
#

Thanks again,
Rene

ps. Axel, I had looked at the posting suggesting g95 compiler, this didn't seem to work - instead installing the latest gfortran (it isn't usually a included in the Xcode bundle on a mac) from here http://gcc.gnu.org/wiki/GFortranBinaries did the trick.

Hi Rene,

Are you showing us the full output?

If so, it looks like the files ctffind3.o, iof.o and ioc.o were compiled on a 32bit machine, and you just attempted to link them. Try "rm -f *.o" before invoking make.

If not, and you are just showing part of the output - could you give the full output?

Cheers,
Alexis