Error: /usr/bin/ld: cannot find -lGLU

Dear all,

Today I am going to compile the sample examples in NVIDIA_GPU_Computing_SDK/C directory by typing the command make & it results in the following error.

[root@cuda1 C]# make
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/common' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/common’
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/common' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/common’
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/common' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/common’
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/shared' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/shared’
make -C src/scan/
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/src/scan' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/src/scan’
make -C src/sortingNetworks/
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/src/sortingNetworks' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/src/sortingNetworks’
make -C src/alignedTypes/
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/src/alignedTypes' make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/src/alignedTypes’
make -C src/bicubicTexture/
make[1]: Entering directory /root/NVIDIA_GPU_Computing_SDK/C/src/bicubicTexture' /usr/bin/ld: cannot find -lGLU collect2: ld returned 1 exit status make[1]: *** [../../bin/linux/release/bicubicTexture] Error 1 make[1]: Leaving directory/root/NVIDIA_GPU_Computing_SDK/C/src/bicubicTexture’
make: *** [src/bicubicTexture/Makefile.ph_build] Error 2
[root@cuda1 C]#

Can Someone PLease through some light on the root cause of this problem.

Thanks & best Regards
Adarsh Sharma

It’s obviously not finding the GLU library. This should only affect the OpenGL-related samples, so the other ones (which are not using OpenGL) should work, anyhow.

In general, you should have files like “libGLU.a” or “libGLU.so” somewhere on your system. A websearch for the error message brings some results, for example this thread which states that this could possibly be solved by installing the MESA OpenGL library.

(BTW: This question is not really related to JCuda - although I can try to help you, as you can see, chances to get a helpful answer for non-JCuda-specific questions are much higher in the NVIDIA forums)

Thanks Marco, I will do it later.

But Is there any document in the net that describes how to write & run simple Cuda Programs in Linux based systems.

With best regards,

Adarsh Sharma

Writing a new CUDA program from scratch would require some effort. It would take some time for setting up the basic project structure and to get familiar with the connection of the NVCC (CUDA-compiler) and the GCC (C-Compiler). Of course, there is lots of documentation, e.g. for the NVCC, in the /doc/ subdirectory of the CUDA Toolkit, but this may be overwhelming. Additionally, there is a lot of “boilerplate code” which is necessary to initialize the devices and to a simple CUDA-kernel call. Writing this code completely on your own, by just reading the “CUDA Programming Guide” would be tedious.

So one feasible approach is probably to compile and start one the simpler SDK examples (so for the first tests, you may ignore the OpenGL-related examples which caused the error message). The vector addition example is the “classical” starting point for that. It should be possible to compile this single example by executing “make” - preferably only for this example, not for the whole SDK.

Once it is running, you may play around with the kernel, e.g. modify it to compute a vector product, or some similar operation (like “smoothing” an array by computing “out**=(in[i-1]+in**+in[i+1])/3” or something). Afterwards, depending on how assured you feel, you may start exploring the CUDA API on the C side, with help from the “CUDA Programming Guide”. This could consist of simple things like extending the prgram to add 3 vectors instead of 2, to see how specific aspects your own problems (like word counting or reduction) could be done in CUDA.