4 Replies Latest reply on Nov 28, 2011 6:15 PM by david_va

    OpenCL samples, undefined reference


      I'm trying to compile the OpenCL samples included in the AMD SDK, but I keep running into the following error:




      Building build/debug/x86_64/BoxFilterGL

      g++ -o build/debug/x86_64/BoxFilterGL build/debug/x86_64//BoxFilterGL.o build/debug/x86_64//BoxFilterGLSeparable.o build/debug/x86_64//BoxFilterGLSAT.o -lpthread -ldl -L/usr/X11R6/lib   -lSDKUtil  -lglut  -lGLEW  -lOpenCL   -L../../../../../lib/x86_64  -L../../../../../TempSDKUtil/lib/x86_64 -L"/lib/x86_64"  

      /usr/bin/ld: build/debug/x86_64//BoxFilterGLSeparable.o: undefined reference to symbol 'gluPerspective'

      /usr/bin/ld: note: 'gluPerspective' is defined in DSO /usr/lib64/libGLU.so.1 so try adding it to the linker command line

      /usr/lib64/libGLU.so.1: could not read symbols: Invalid operation



      I'm using the KDE spin of Fedora 16 (I know it's not officially supported) with the newest freeglut libraries available in the repositories (I think version 2.6?)  I know I can specify the -libglu in the linker options, but I'm not sure where to add the command as the Makefiles traverse multiple subdirectories.  Can anyone offer a suggestion on where to make the fix?  Thanks!


        • OpenCL samples, undefined reference

          i think you need install glu dev files.

          • OpenCL samples, undefined reference

            You can add new libs in the makefile of any particular sample. Do you have mesa installed on your system?

              • OpenCL samples, undefined reference


                Scharupa, your solution did work to get past the GL error, but there is another error:




                g++  -Wpointer-arith   -Wfloat-equal -g3 -ffor-scope   -I  ../../../../../samples/opencl/SDKUtil/include -I  "/include"  -I  ../../../../../include  -o build/debug/x86_64//BoxFilterGLSAT.o -c  BoxFilterGLSAT.cpp

                make: *** No rule to make target `../../../../../samples/opencl/SDKUtil/build/debug/x86_64//libSDKUtil.a', needed by `build/debug/x86_64/BoxFilterGL'.  Stop.



                I'm trying to target an AMD CPU, so I did realize that the GL samples probably won't work, especially because I'm not currently running an AMD GPU.  I'm still very new to OpenCL, so I'm not sure if the GL samples would work on a non-AMD GPU.  Since I have access to the precompiled samples in the bin folder that normally would have been missed after the make exit, I can at least make use of the samples that don't require GL, which seem to be working.


              • OpenCL samples, undefined reference

                Can you change the make file and try again.


                LLIBS += glut GLEW


                 LLIBS += glut GLEW GL GLU