QtOpenCl“未定义引用”会产生错误

时间:2010-06-11 05:16:21

标签: c++ qt makefile opencl

所以我下载了ATI Stream SDK。我现在没有gpu所以我使用'-device cpu'并通过将目录添加到LD_LIBRARY_PATH等来获取OpenCl目录中的程序/示例。

现在问题出在安装QtOpenCl时。

configure脚本给了我:

skkard@skkard-desktop:~/Applications/qt-labs-opencl$ ./configure

This is the QtOpenCL configuration utility.

Qt version ............. 4.6.2
qmake .................. /usr/bin/qmake
OpenCL ................. yes
OpenCL/OpenGL interop .. yes
Extra QMAKE_CXXFLAGS ...
Extra INCLUDEPATH ......
Extra LIBS ............. -lOpenCL

QtOpenCL has been configured.  Run '/usr/bin/make' to build.

Make给我:

skkard@skkard-desktop:~/Applications/qt-labs-opencl$ make
cd src/ && make -f Makefile 
make[1]: Entering directory `/home/skkard/Applications/qt-labs-opencl/src'
cd opencl/ && make -f Makefile 
make[2]: Entering directory `/home/skkard/Applications/qt-labs-opencl/src/opencl'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/src/opencl'
cd openclgl/ && make -f Makefile 
make[2]: Entering directory `/home/skkard/Applications/qt-labs-opencl/src/openclgl'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/src/openclgl'
make[1]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/src'
cd examples/ && make -f Makefile 
make[1]: Entering directory `/home/skkard/Applications/qt-labs-opencl/examples'
cd opencl/ && make -f Makefile 
make[2]: Entering directory `/home/skkard/Applications/qt-labs-opencl/examples/opencl'
cd vectoradd/ && make -f Makefile 
make[3]: Entering directory `/home/skkard/Applications/qt-labs-opencl/examples/opencl/vectoradd'
g++  -o vectoradd vectoradd.o qrc_vectoradd.o    -L/usr/lib -L../../../lib -L../../../bin -lQtOpenCL -lQtGui -lQtCore -lpthread 
../../../lib/libQtOpenCL.so: undefined reference to `clBuildProgram'
../../../lib/libQtOpenCL.so: undefined reference to `clSetCommandQueueProperty'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueNDRangeKernel'
../../../lib/libQtOpenCL.so: undefined reference to `clSetKernelArg'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueCopyBufferToImage'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseMemObject'
../../../lib/libQtOpenCL.so: undefined reference to `clFinish'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueUnmapMemObject'
../../../lib/libQtOpenCL.so: undefined reference to `clGetMemObjectInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueReadImage'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueMarker'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainCommandQueue'
../../../lib/libQtOpenCL.so: undefined reference to `clGetCommandQueueInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueCopyImage'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseContext'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainMemObject'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseEvent'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueWriteBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueCopyBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueMapImage'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueReadBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clUnloadCompiler'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueBarrier'
../../../lib/libQtOpenCL.so: undefined reference to `clGetProgramBuildInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueWaitForEvents'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainProgram'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateContext'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateImage3D'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueMapBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clGetDeviceIDs'
../../../lib/libQtOpenCL.so: undefined reference to `clGetContextInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clGetDeviceInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseCommandQueue'
../../../lib/libQtOpenCL.so: undefined reference to `clGetSamplerInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clGetPlatformIDs'
../../../lib/libQtOpenCL.so: undefined reference to `clGetSupportedImageFormats'
../../../lib/libQtOpenCL.so: undefined reference to `clGetPlatformInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clWaitForEvents'
../../../lib/libQtOpenCL.so: undefined reference to `clGetEventInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clGetEventProfilingInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clGetImageInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateProgramWithBinary'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseSampler'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateCommandQueue'
../../../lib/libQtOpenCL.so: undefined reference to `clGetKernelWorkGroupInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainEvent'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainContext'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateSampler'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseProgram'
../../../lib/libQtOpenCL.so: undefined reference to `clFlush'
../../../lib/libQtOpenCL.so: undefined reference to `clGetProgramInfo'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateKernel'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainKernel'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueWriteImage'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateKernelsInProgram'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateProgramWithSource'
../../../lib/libQtOpenCL.so: undefined reference to `clReleaseKernel'
../../../lib/libQtOpenCL.so: undefined reference to `clRetainSampler'
../../../lib/libQtOpenCL.so: undefined reference to `clCreateImage2D'
../../../lib/libQtOpenCL.so: undefined reference to `clEnqueueCopyImageToBuffer'
../../../lib/libQtOpenCL.so: undefined reference to `clGetKernelInfo'
collect2: ld returned 1 exit status
make[3]: *** [vectoradd] Error 1
make[3]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/examples/opencl/vectoradd'
make[2]: *** [sub-vectoradd-make_default] Error 2
make[2]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/examples/opencl'
make[1]: *** [sub-opencl-make_default] Error 2
make[1]: Leaving directory `/home/skkard/Applications/qt-labs-opencl/examples'
make: *** [sub-examples-make_default-ordered] Error 2

使用'-no-openclgl'尝试使用它,但没有编译任何示例等。

我正在使用从synaptic安装的Qt使用ubuntu 10.04。

1 个答案:

答案 0 :(得分:2)

我猜你没有链接OpenCL运行时。 QT库正在调用这些函数,但它们不会在另一个文件中定义。您必须链接“该”文件以解决您的问题。