Good morning from Germany!
After setting up CUDA on Ubuntu 11.04 using these instructions (Samiux's Blog: HOWTO : nVidia CUDA Toolkit 4.0 on Ubuntu 11.04 Desktop) I can run the CUDA samples of the SDK, but when trying to compile the examples of the book ‘CUDA By Example’ I get the following error-code:
[indent]r00t@r00t-EG41MF-US2H:~/Documents/cuda_by_example/chapter03$ nvcc hello_world.cu
In file included from /usr/lib/nvidia-cuda-toolkit/include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/include/host_config.h:82:2: warning: #warning – unsupported GNU version! gcc 4.5 and up are not supported!
In file included from /usr/lib/nvidia-cuda-toolkit/include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/include/host_config.h:82:2: warning: #warning – unsupported GNU version! gcc 4.5 and up are not supported!
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `HandleError(cudaError, char const*, int)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x1e): undefined reference to `cudaGetErrorString’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `start_thread(void* ()(void), void*)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x198): undefined reference to `pthread_create’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `end_thread(unsigned long)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x1bb): undefined reference to `pthread_join’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `destroy_thread(unsigned long)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x1d5): undefined reference to `pthread_cancel’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `__cudaUnregisterBinaryUtil()':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x242): undefined reference to `__cudaUnregisterFatBinary’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `__device_stub__Z14float_to_colorPhPKf(unsigned char*, float const*)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x26a): undefined reference to `cudaSetupArgument’
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x289): undefined reference to `cudaSetupArgument’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `__device_stub__Z14float_to_colorP6uchar4PKf(uchar4*, float const*)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x2fe): undefined reference to `cudaSetupArgument’
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x31d): undefined reference to `cudaSetupArgument’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `__sti____cudaRegisterAll_46_tmpxft_00000954_00000000_4_hello_world_cpp1_ii_68d40520()':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x37e): undefined reference to `__cudaRegisterFatBinary’
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x3dc): undefined reference to `__cudaRegisterFunction’
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text+0x429): undefined reference to `__cudaRegisterFunction’
/tmp/tmpxft_00000954_00000000-13_hello_world.o: In function `cudaError cudaLaunch(char*)':
tmpxft_00000954_00000000-1_hello_world.cudafe1.cpp:(.text.Z10cudaLaunchIcE9cudaErrorPT[cudaError cudaLaunch(char*)]+0x14): undefined reference to `cudaLaunch’
collect2: ld returned 1 exit status[/indent]
To me it seems like I did not set up my environment the right way so gcc or nvcc does not now where to get the CUDA function code, but I am a Linux and CUDA beginner and do not have any idea how to solve this problem. Any help is appreciated! LG r00t