Possible nvcc problem on my system

I can’t compile any .cu files with nvcc. I don’t know if I’m doing something wrong or if there is a problem with my systems’ setup. Everytime I try compiling I get the following.

nvcc ~/src/cuda/learning/ParameterPassing.cu 

/usr/include/surface_functions.h: In function ‘void surf1Dread(T*, surface<void, 1>, int, int, cudaSurfaceBoundaryMode)’:

/usr/include/surface_functions.h:100:95: error: there are no arguments to ‘__surf1Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadc1’ must be available

/usr/include/surface_functions.h:100:95: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)

/usr/include/surface_functions.h:101:96: error: there are no arguments to ‘__surf1Dreads1’ that depend on a template parameter, so a declaration of ‘__surf1Dreads1’ must be available

/usr/include/surface_functions.h:102:94: error: there are no arguments to ‘__surf1Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu1’ must be available

/usr/include/surface_functions.h:103:94: error: there are no arguments to ‘__surf1Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu2’ must be available

/usr/include/surface_functions.h:104:95: error: there are no arguments to ‘__surf1Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf1Dreadu4’ must be available

/usr/include/surface_functions.h: In function ‘void surf2Dread(T*, surface<void, 2>, int, int, int, cudaSurfaceBoundaryMode)’:

/usr/include/surface_functions.h:460:98: error: there are no arguments to ‘__surf2Dreadc1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadc1’ must be available

/usr/include/surface_functions.h:461:99: error: there are no arguments to ‘__surf2Dreads1’ that depend on a template parameter, so a declaration of ‘__surf2Dreads1’ must be available

/usr/include/surface_functions.h:462:97: error: there are no arguments to ‘__surf2Dreadu1’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu1’ must be available

/usr/include/surface_functions.h:463:97: error: there are no arguments to ‘__surf2Dreadu2’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu2’ must be available

/usr/include/surface_functions.h:464:98: error: there are no arguments to ‘__surf2Dreadu4’ that depend on a template parameter, so a declaration of ‘__surf2Dreadu4’ must be available

I’m running Arch Linux x64 with the cuda 3.2, cuda-toolkit 3.2 and cuda-sdk 3.2 packages installed from schnouki’s repo. I also have the NVidia dev driver installed for the 3.2 toolkit.

Why am I getting that ouput every single time I try and compile a .cu, any .cu source?

What gcc version is this with ? Gcc 4.5?

I tested this with gcc 4.5.1, which is native on my system AND with 4.4.2 which I got from schounki’s repo. The result of using the command ‘nvcc -ccbin=/opt/gcc-4.4/gcc ~/src/cuda/learning/ParameterPassing.cu’ is the same as trying it without the -ccbin option.

I think the answer to your problem can be found in this line of your original post

note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)

Try passing -Xcompiler="-fpermissive" as an argument to nvcc and see what it does.

avidday, here is the result of using fpermissive.

nvcc -ccbin=/opt/gcc-4.4/gcc -Xcompiler="-fpermissive" ~/src/cuda/learning/ParameterPassing.cu 

cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C

cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C

I’m trying to compile a .cu source for use by the device. I’m not trying to compile C++ host code.

FYI, I’m following the book CUDA By Example. Currently on chapter 3. I’m also not using the include book.h statement in my source because I just want to get one simple .cu file compiled and working and the get the same errors as in my first post when I include that anyways.

Am I missing something here? I’ve been following the book to the letter but it feels like it’s not telling me something here.

The compilation of device code relies on the host C++ compiler. I don’t see any errors in that output it posted, it looks like it worked to me…

Oh, you’re right, it did work. The a.out executable was in my home folder, I didn’t see it and assumed it still hadn’t worked.

Thanks for clearing that up avidday.