CUDA 1.1 XP 64 Cross Compile using Visual Studio 8

Now that CUDA 1.1 supports Windows XP 64, I have started migrating my apps to the new platform. While doing so, I have found that I am only able to successfully compile cuda source files when the target platform matches the build platform;

i.e Build -> Target
1 WIN32 -> WIN32 = success
2 WIN32 -> WIN64 = failure
3 WIN64 -> WIN32 = failure
4 WIN64 -> WIN64 = success

The error I encounter during case (2) is the following:
fatal error LNK1112: module machine type ‘X86’ conflicts with target machine type ‘x64’ (and vice versa for case 3)

In order to compile my cuda source files, I am using the ‘-c’ option and supplying the msvc compiler directory, in the same way as is done in the CUDA SDK examples. Note that the SDK examples will also fail in the same way as above.

It is my understanding that although you cannot run a 64-bit windows app on a 32-bit platform, visual studio allows you to compile the 64-bit app on the 32-bit platform. I do almost all of my development on WinXP 32 and so I would hate to have to use multiple machines simply to ensure that my 64-bit configuration builds successfully.

Has anyone else run into this issue? Any solutions?

My guess would be that you need both 64-bit toolkit and SDK to compile for x64, not just change target in MSVC. And I’m not sure if theese will install on 32-bit Windows.

My best guess for the reason that the above errors arise is because nvcc invokes the compiler related to each particular system when compiling the CUDA file. For example, when trying to target WinXP 64 on a Win32 system, the nvcc compiler will invoke the Win32 compiler, instead of invoking the Win64 compiler.

If this is true, then it should be a fairly simple fix for nvcc to invoke the compiler that is appropriate to the platform, although this would probably have to be done through a command line argument to nvcc because otherwise it wouldn’t know which one to launch. A command line argument of this nature already exists (-m,–machine) for 32 vs. 64 bit linux builds, so I wouldn’t expect it to be a big change to support it for msvc as well.

With this in mind, however, has anyone found a workaround for the current system?

I apologize for digging out this old thread but I’m wondering if anyone has been able to crosscompile binaries for x64 windows using a 32bit build system.
Any hints would be greatly appreciated.

Yeah I am also confronting the similar situation. I have XP 64 Bit OS and have installed CUDA 2.0 with 177.34 driver. I am trying to build the SDK example for device query for win32 configuration in VS 2005 and am getting the linking error as follows
Linking…
1>deviceQuery.obj : error LNK2019: unresolved external symbol _cudaGetDeviceProperties@8 referenced in function _main
1>deviceQuery.obj : error LNK2019: unresolved external symbol _cudaGetDeviceCount@4 referenced in function _main
1>deviceQuery.obj : error LNK2019: unresolved external symbol ___cudaUnregisterFatBinary@4 referenced in function ___cudaUnregisterBinaryUtil
1>deviceQuery.obj : error LNK2019: unresolved external symbol ___cudaRegisterFatBinary@4 referenced in function ___sti____cudaRegisterAll_46_tmpxft_00000dc4_00000000_6_deviceQuery_cpp1_ii_main

The same example runs when the build target is X64(for Release and Debug case)
but above mentioned linking errors come when build target is win32(for Release and Debug case)

Anybody encountered this kinda issue.

Another thing which I wanna ask is that is it possible to use cuda.lib for both X64 and win32 configuration in VS2005. Means I have another app in whcih I only use device functions i.e cuXXXX functions. But for win32 build target, I get linking error.
Is it not possible to build 32 bit CUDA apps in 64 bit OS environment?

Cheers!!!
Sandeep

Good grief this simple issue is still not fixed yes? Or did I miss it. Please I need to build my 32 & 64 bit binaries on a 32bit machine