When trying to get CUDA 4.2.9 toolkit, drivers and SDK to work on Kubuntu 12.04 I had to sort out a number of small issues.
First DONT install any other Nvidia drivers! I did this in my first attempt and ended up not having any success and finally just reinstalled Kubuntu.
This didn't really work for me so you can link some things manually (below), or you can add -L/usr/lib/nvidia-current/ to the relevant Makefiles.
from the menu to get a terminal.
Remount the file system to write access.
Next set-up the e
nvironment, by purging driver pakage, and getting kernel source
sudo apt-get update
sudo apt-get purge nvidia-current
sudo apt-get install linux-source linux-headers-generic linux-image
Next download, build and Install the drivers:
wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/drivers/devdriver_4.2_linux_64_295.41.run
chmod +x devdriver_4.2_linux_64_295.41.run
sudo ./devdriver_4.2_linux_64_295.41.run
You may need to blacklist the nouveau and other nvidia drivers:
sudo sh -c "echo blacklist nouveau >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist lbm-nouveau >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist nvidia-173 >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist nvidia-96 >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist nvidia-current-updates >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist nvidia-173-updates >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo blacklist nvidia-96-updates >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo alias nouveau off >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo alias lbm-nouveau off >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
sudo sh -c "echo options nouveau modeset=0 >> /etc/modprobe.d/nvidia-graphics-drivers.conf"
4. Install the SDK
wget http://developer.download.nvidia.com/compute/cuda/4_2/rel/sdk/gpucomputingsdk_4.2.9_linux.run
chmod +x gpucomputingsdk_4.2.9_linux.run
./gpucomputingsdk_4.2.9_linux.run
make will fail
undefined reference to 'gluErrorString'
This post helped me sort it out
My soulution was:
Open C/common/common.mk and CUDALibraries/common/common_cudalib.mk and put $(RENDERCHECKGLLIB) befor ${OPENGLLIB} in all the relevant places.
I then got:
freeImageInteropNPP.cpp:(.text+0x6bd): undefined reference to `nppGetLibVersion'
freeImageInteropNPP.cpp:(.text+0x6c6): undefined reference to `nppGetGpuComputeCapability'
freeImageInteropNPP.cpp:(.text+0x713): undefined reference to `nppGetGpuNumSMs'
freeImageInteropNPP.cpp:(.text+0x71a): undefined reference to `nppGetGpuName'
/tmp/cc11BgVS.o: In function `main':
freeImageInteropNPP.cpp:(.text+0x131d): undefined reference to `nppiMalloc_8u_C1'
freeImageInteropNPP.cpp:(.text+0x144c): undefined reference to `cudaMemcpy2D'
freeImageInteropNPP.cpp:(.text+0x15a0): undefined reference to `nppiMalloc_8u_C1'
freeImageInteropNPP.cpp:(.text+0x16cb): undefined reference to `nppiFilterBox_8u_C1R'
freeImageInteropNPP.cpp:(.text+0x1941): undefined reference to `cudaMemcpy2D'
freeImageInteropNPP.cpp:(.text+0x1b58): undefined reference to `cudaDeviceReset'
/tmp/cc11BgVS.o: In function `cudaSafeCallNoSync(cudaError, char const*, int)':
freeImageInteropNPP.cpp:(.text._Z18cudaSafeCallNoSync9cudaErrorPKci[cudaSafeCallNoSync(cudaError, char const*, int)]+0x23): undefined reference to `cudaGetErrorString'
/tmp/cc11BgVS.o: In function `cudaDeviceInit()':
freeImageInteropNPP.cpp:(.text._Z14cudaDeviceInitv[cudaDeviceInit()]+0x26): undefined reference to `cudaGetDeviceCount'
freeImageInteropNPP.cpp:(.text._Z14cudaDeviceInitv[cudaDeviceInit()]+0x173): undefined reference to `cudaGetDeviceProperties'
freeImageInteropNPP.cpp:(.text._Z14cudaDeviceInitv[cudaDeviceInit()]+0x1d9): undefined reference to `cudaSetDevice'
collect2: ld returned 1 exit status
The problem here is that library's are placed before the source files, simple fix:
In the boxFilterNPP, imageSegmentationNPP, freeImageInteropNPP, histEqualizationNPP and
Makefiles and put $(LIB) after the source files:
$(CXX) $(INC) -o boxFilterNPP boxFilterNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
$(CXX) $(INC) -o imageSegmentationNPP imageSegmentationNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
$(CXX) $(INC) -o freeImageInteropNPP freeImageInteropNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
$(CXX) $(INC) -o histEqualizationNPP histEqualizationNPP.cpp $(LIB) -lUtilNPP_$(LIB_ARCH) -lfreeimage$(FREEIMAGELIBARCH)
Finally to fix errors in randomFog:
Include
USERENDERCHECKGL := 1
in the Makefile and change
RENDERCHECKGLLIB := -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)
to
RENDERCHECKGLLIB := -L../../../C/lib -lrendercheckgl_$(LIB_ARCH)$(LIBSUFFIX)
in common_cudalib.mk