Linking error using CUDA + OpenCV

Hi

I’m trying to get this thing work. I’m using OpenCV just to read/write images, but I can’t make it work when compiling with nvcc.

I have 3 files:

[list=1]

[*]Prueba.c: Here I load and image with functions from Image.c then call a function to convert the RGB image to Grayscale and finally save the new image.

[*]Image.c: Here are the functions of load/save images, if I work all with .c-files everything works fine.

[*]Conversion.cu: Here I made a parallel function to convert RGB to Grayscale.

To compile I use the following command:

nvcc Prueba.c Image.c ColorConversion.cu -o test -I/usr/local/include/opencv -L/usr/local/lib -lcxcore -lcv -lhighgui -lcvaux

But a lot of errors appear, some of them are:

ptxas /tmp/tmpxft_000003de_00000000-2_pprColorConversion.ptx, line 87; warning : Double is not supported. Demoting to float

ld: warning: in /usr/local/lib/libcxcore.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /usr/local/lib/libcv.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /usr/local/lib/libhighgui.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /usr/local/lib/libcvaux.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

Undefined symbols:

  "_cvGetRows", referenced from:

      _cvGetRow in tmpxft_000003de_00000000-4_Prueba.o

      _cvGetRow in tmpxft_000003de_00000000-5_Image.o

  "_cvLog", referenced from:

      _cvbFastLog in tmpxft_000003de_00000000-4_Prueba.o

      _cvbFastLog in tmpxft_000003de_00000000-5_Image.o

  "_cvCreateMat", referenced from:

      _cvFindFundamentalMatrix in tmpxft_000003de_00000000-4_Prueba.o

      _cvFindFundamentalMatrix in tmpxft_000003de_00000000-4_Prueba.o

      _cvKMeans in tmpxft_000003de_00000000-4_Prueba.o

      _cvFindFundamentalMatrix in tmpxft_000003de_00000000-5_Image.o

      _cvFindFundamentalMatrix in tmpxft_000003de_00000000-5_Image.o

      _cvKMeans in tmpxft_000003de_00000000-5_Image.o

  "_cvBoxPoints", referenced from:

      _cvMinAreaRect in tmpxft_000003de_00000000-4_Prueba.o

      _cvMinAreaRect in tmpxft_000003de_00000000-5_Image.o

  "_cvEllipse", referenced from:

      _cvEllipseBox in tmpxft_000003de_00000000-4_Prueba.o

      _cvEllipseAA in tmpxft_000003de_00000000-4_Prueba.o

      _cvEllipseBox in tmpxft_000003de_00000000-5_pprImage.o

      _cvEllipseAA in tmpxft_000003de_00000000-5_Image.o

Seems that it has something to do with OpenCV functions, but how can I build my application.

Thanks.

P.S. I’m doing it all under Mac OS X 10.6.6

Any ideas?

I tried to compile OpenCV 2.1 with the option -D CMAKE_OSX_ARCHITECTURES=i386 but it can’t be configured with that option.
I also tried OpenCV 2.2 but with this I can’t even compile my programs without CUDA.

Don’t know what to do, any ideas?