Compiling with nvcc and gcc on Mac OSX Mountain Lion

Hello, I have a custom automake project that runs smoothly on Linux, and used to run smoothly on Mac OS X as well, however, after updating to CUDA-5.0 and to Mountain Lion, every time I try to compile it fails me, here’s the compile line and output:

nvcc -o main.o -c main.cu -gencode arch=compute_12,code=sm_12
nvcc -o ca.o -c ca.cu -gencode arch=compute_12,code=sm_12
nvcc -o curand.o -c curand.cu -gencode arch=compute_12,code=sm_12
gcc -I/usr/local/cuda/include -g -O2   -o cu1dCA main.o ca.o curand.o -L/usr/local/cuda/lib64 -lcudart -lm 
ld: warning: ld: warning: ignoring file main.o, file was built for i386 which is not the architecture being linked (x86_64): main.oignoring file ca.o, file was built for i386 which is not the architecture being linked (x86_64): ca.o

ld: warning: ignoring file curand.o, file was built for i386 which is not the architecture being linked (x86_64): curand.o
Undefined symbols for architecture x86_64:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64

But if I try to compile manually, only with nvcc, it goes smoothly

$ nvcc -o cu1dCA main.cu ca.cu curand.cu
$ file cu1dCA 
cu1dCA: Mach-O executable i386

But, as you can see, it’s actually building i386 code, instead of x64, which is what my Mac OS X actually is.
Any help on how to fix this?

Thank you.

have you tried using -m64 option ?
ex: nvcc -m64 …

It worked, thanks ;).