QtOpenCl“undefined reference”制作错误

3

我下载了ATI Stream SDK。由于我现在没有GPU,因此我使用“- device cpu”选项,并通过将该目录添加到LD_LIBRARY_PATH等来使OpenCl目录中的程序/示例正常工作。

现在的问题是安装QtOpenCl时出现的问题。

配置脚本告诉我:

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个回答

2

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


你是说创建系统链接吗?在哪里以及如何创建? - Khushman Patel
不,你必须链接OpenCL库(即.so文件)! - Goz
怎么做?:(。我不明白你在说什么。你能详细解释一下吗?谢谢。 - Khushman Patel
我尝试使用"-lOpenCL"参数编译与make相同的内容,并成功编译了。但是虽然vectoradd示例可以工作,但其他一些示例却不能。 - Khushman Patel
那么,您链接的库存在问题,或者您正在链接错误的库。我不确定还能提出什么建议,但我建议如果您无法将应用程序链接在一起,那么也许您应该从比OpenCL更简单的东西开始。 - Goz
它起作用了。在安装OpenCL之前,我似乎已经运行过配置脚本一次。获取文件的新副本起作用了。感谢goz! - Khushman Patel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接