Problem compiling basic programs

I did not have problems compiling the programs from the SDK (at least not those supported by my video card) but I can’t compile basic programs that I have written.

Edit:

I was wrong, the reason the SDK was compiled successfully is that I had compiled it when I had the drivers installed though unbuntu’s device drivers (version 195.xx). When I had those drivers the programs compiled fine but did not execute correctly. For example the programs I compiled before upgrading to the drivers from the nvidia website run fine now after installing the up to date drivers but they did not run correctly before upgrading the drivers. On the other hand, now I can’t compile! I have already reinstalled the cuda 3.1 toolkit.

End edit

For example if I compile this program:

// test.cu

int main()

{

   return 0;

}

using nvcc -o test test.cu

I get:

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

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

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

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

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

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

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

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

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

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

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

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

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

test.cu: In function ‘void vecPrint(const char*, const float*, int)’:

test.cu:19: warning: format not a string literal and no format arguments

I have a 64 bit ubuntu 10.04 os and a 8800 GTX (768mb) video card. My cuda version info is:

nvcc: NVIDIA ® Cuda compiler driver

Copyright © 2005-2010 NVIDIA Corporation

Built on Mon_Jun__7_18:56:31_PDT_2010

Cuda compilation tools, release 3.1, V0.2.1221

I installed my nvidia driver from the binaries on the nvidia webpage and my current version is the newest (256.35).

Edit:

I have “solved” the problem by compiling the program using

nvcc -o test --compiler-options -fpermissive test.cu

and get

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

Programs compiled this way work as expected but I don’t consider this a solution because I should not have to to this.

End endit

Thanks for the post!! I had the same problem.

Thank you your solution!

I wonder why it did not happen when I compiled samples and templates.

Once I tried to run my own programs, the error came out. Is it possible to embed your solution into NVIDIA provided “common.mk” file? Such that, I can use as “make” to build the project.

Thanks in advance.

Thanks a lot… It helped a great… I was almost lost after setting up everything when I see its not running I had no otherway to get rid of this bug… then I got your post and helped a great… thank you.

-r

Jay

Thanks a lot… It helped a great… I was almost lost after setting up everything when I see its not running I had no otherway to get rid of this bug… then I got your post and helped a great… thank you.

-r

Jay

This problem still appears to be present in the newest release of CUDA on Mac. (I know this is in the Linux forum.) I can compile using using this flag, but the warnings it creates are really annoying.

Has anyone found a real solution yet? NVIDIA??? I’ve tried fixing the header file, but it doesn’t appear to be possible, and it doesn’t look like this error should be generated with the original version to begin with. This looks very much like a bug in nvcc.

Are you sure about that? If I compile the empty main repo case with CUDA 3.2 on a 32 bit OS X box (10.6.5 with gcc 4.2.1 build 5664), it compiles without error or warning:

MacBook-Air:~ avidday$ gcc --version

i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)

Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

MacBook-Air:~ avidday$ nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver

Copyright (c) 2005-2010 NVIDIA Corporation

Built on Thu_Nov_11_15:26:50_PST_2010

Cuda compilation tools, release 3.2, V0.2.1221

MacBook-Air:~ avidday$ cat junk.cu

int main(void)

{

	return 0;

}

MacBook-Air:~ avidday$ nvcc junk.cu -o junk

MacBook-Air:~ avidday$ otool -L junk

junk:

	@rpath/libcudart.dylib (compatibility version 1.1.0, current version 3.2.0)

	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)

	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

What errors do you get?

Had the same problem CUDA 3.2, 64bit on Ubuntu 10.10. Could anybody tell me weather this is a bug or not (if so please explain what causes it) and if (or when) there is a real solution available.