nvcc w cygwin gcc (not cl) how to use cygwin to build cuda apps

I would like to use cygwin with the CUDA tools to build CUDA applications on XP.

I tried using the --foreign option with nvcc but the attempt to compile the matrixMul.cu file fails with the following types of errors from cudafe:

nvcc  --foreign --keep --verbose -dp /local/cygwin/  -I /c/local/NVIDIA_CUDA_SDK/common/inc/ matrixMul.cu 2>&1 | head -30

#$ _SPACE_= 

#$ _HERE_=c:\local\CUDA\bin

#$ TOP=c:\local\CUDA\bin/..

#$ PATH=... # too long to print

#$ INCLUDES="-Ic:\local\CUDA\bin/../include" "-Ic:\local\CUDA\bin/../include/cudart"  

#$ LIBRARIES=  "c:\local\CUDA\bin/../lib/cuda.lib" "c:\local\CUDA\bin/../lib/cudart.lib"  /OPT:NOICF



#$ gcc -E -x c++ -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS  "-Ic:\local\CUDA\bin/../include" "-Ic:\local\CUDA\bin/../include/cudart"   -I. -D__CUDACC__ -C  -I"/c/local/NVIDIA_CUDA_SDK/common/inc/" -include "cuda_runtime.h" -m32 -malign-double -o "matrixMul.cpp1.ii" "matrixMul.cu" 

#$ cudafe --m32 "-Ic:\local\CUDA\bin/../include" "-Ic:\local\CUDA\bin/../include/cudart"   -I. --gen_c_file_name "matrixMul.cudafe1.c" --gen_device_file_name "matrixMul.cudafe1.gpu" --include_file_name matrixMul.fatbin.c --diag_error=host_device_limited_call --no_exceptions -tused  -I"/c/local/NVIDIA_CUDA_SDK/common/inc/" "matrixMul.cpp1.ii" 

"c:/local/CUDA/bin/../include/vector_types.h", line 66: error: expected a type


  struct __attribute__((aligned(2))) char2


"c:/local/CUDA/bin/../include/vector_types.h", line 66: error: function

          "aligned" returns incomplete type "__attribute__"

  struct __attribute__((aligned(2))) char2


"c:/local/CUDA/bin/../include/vector_types.h", line 66: error: expected a "{"

  struct __attribute__((aligned(2))) char2


"c:/local/CUDA/bin/../include/vector_types.h", line 69: warning: missing

          return statement at end of non-void function "aligned"



"c:/local/CUDA/bin/../include/vector_types.h", line 68: warning: variable "x"


I had hoped that since gcc was supported for linux, it would be possible to use cygwin gcc tools under windows. The problem line:

struct __attribute__((aligned(2))) char2

works fine with gcc but cudafe reports an error. Has anyone gotten the CUDA tools to work with cygwin rather than MSVC? Is it even possible?

Suggestions welcome.

Thanks much.

You can download MicrosoftVS Express, the free version of visual studio, which comes with a command line compiler. You can use that from cygwin and it should work.

Edit: After seeing your subject line I see you do not want to use cl. Then my question is why? It is free…


since this thread is already quite old, I was wondering if anybody has made any progress on this topic?

That is: is it in the meantime possible to use cygwin in combination with gcc (NOT cl) on windows XP?

(the reason why I’d need this setup is that CUDA should be used in conjunction with an existing application that needs to be compiled with gcc).

Thanks in advance!

As far as I know, it’s not possible to use the Cygwin gcc with CUDA.

Thanks (although I had hoped for a different answer :ermm:)

OK let me ask again, since this thread is two years old: is it possible to use CUDA with cygwin gcc??

According to the NVCC guide this is still not possible.

According to the NVCC guide this is still not possible.


I had the same question (aka being able to use nvcc without cl, gcc for example) and disappointed to hear that it is not possible. The reason for not using MS VS express is that it is only for 32bits and my machine has windows 7 64bits…

I guess I will need to buy MSVS 10…

I have the same problem. As a work-around I compile .cu files with the -m32 flag. This produces a 32-bit executable, that runs without problems on a 64-bit Windows 7 system. One needs to set CUDA_LIB = $(CUDA_PATH)\lib\Win32\cudart.lib for linking - I use Makefiles with nmake.exe and cl.exe, not the VS IDE.