Building OpenCV 2.4.8 with CUDA 5.5

asked 2014-02-03 08:48:37 -0500

pistorinoj gravatar image

I am trying to build CUDA 5.5 with OpenCV 2.4.8 to make an x86 application.

I am running on Windows 8.1 64 bit using VS2012 C++/cli and am having crazy troubles getting my app to build.

I downloaded CUDA 5.5 Windows 8.1 64 bit for Desktop (it will not let me install 32 bit anyway).

Then, I did the following:

1) load CMake and set the target machine as Visual Studio 11 (not Win 64)

2) turn off CUDA BUILD ATTACH v RULE

3) configure and generate

4) load the ALL_BUILD project in Visual Studio specifying Win32

During the build, I get the following error:

6>CMakeFiles\cuda_compile.dir__\dynamicuda\src\cuda\Debug\cuda_compile_generated_matrix_operations.cu.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Build FAILED.

It is my understanding that you have to compile everything to your target architecture and since mine is Win32 (because of other libraries), it would seem that I have to build OpenCV to that architecture as well.

What am I doing wrong?

Any help greatly appreciated.

edit retag flag offensive close merge delete

Comments

You need to set the target machine specifically in your visual studio, look into your project options, it is somewhere there and is standard set to the system value, which is x64 in your case!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-05 04:39:15 -0500 )edit

Thanks Steve. In the ALL_BUILD solution, I do not see anywhere to set that. In the configuration manager, you can specify a platform that applies to each project. I have specified win32. Is there somewhere else to set a target machine that you think might still be set to x64? Is is possible to even build 2.4.8 for a win32 target with CUDA on a 64 bit machine? That is what I had before and I can't seem to get back to it.

pistorinoj gravatar imagepistorinoj ( 2014-02-08 17:50:27 -0500 )edit

It should be possible to build 32 bit binaries on a 64 bit system. Vice versa would result into logical problems since memory structures are quite different on 64 bit systems. Hmm I am on a linux machine now, but I can look it up for you. Hang on!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-10 02:59:45 -0500 )edit

Steve - Any luck finding this? Thanks, James

pistorinoj gravatar imagepistorinoj ( 2014-03-05 22:49:35 -0500 )edit

I am sorry but completely lost track of this one :) I tried cross compiling 32 bit dlls on a 64 bit system before, which works perfectly with windows and linux. Make sure all target system parameters in your options are selected as 32 bit when building!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-10 07:13:02 -0500 )edit