编译ffmpeg“ERROR: opencl not found”问题。
ffmpeg在2.x版本支持opencl,可以利用硬件对转码进行加速,故进行编译尝试。
/tmp/ffconf.UNWNaz4r.c:1:23: error: OpenCL/cl.h: No such file or directory/tmp/ffconf.UNWNaz4r.c: In function 'check_clEnqueueNDRangeKernel':/tmp/ffconf.UNWNaz4r.c:2: error: 'clEnqueueNDRangeKernel' undeclared (first use in this function)/tmp/ffconf.UNWNaz4r.c:2: error: (Each undeclared identifier is reported only once/tmp/ffconf.UNWNaz4r.c:2: error: for each function it appears in.)check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCLcheck_func_headers CL/cl.h clEnqueueNDRangeKernel -lOpenCLcheck_ld cc -lOpenCLcheck_ccBEGIN /tmp/ffconf.UNWNaz4r.c 1 #include2 long check_clEnqueueNDRangeKernel(void) { return (long) clEnqueueNDRangeKernel; } 3 int main(void) { return 0; }END /tmp/ffconf.UNWNaz4r.cgcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -O3 -march=nocona -m64 -I/root/20130423/_release/include -std=c99 -fomit-frame-pointer -pthread -c -o /tmp/ffconf.wxa3Qkrq.o /tmp/ffconf.UNWNaz4r.c/tmp/ffconf.UNWNaz4r.c:1:19: error: CL/cl.h: No such file or directory/tmp/ffconf.UNWNaz4r.c: In function 'check_clEnqueueNDRangeKernel':/tmp/ffconf.UNWNaz4r.c:2: error: 'clEnqueueNDRangeKernel' undeclared (first use in this function)/tmp/ffconf.UNWNaz4r.c:2: error: (Each undeclared identifier is reported only once/tmp/ffconf.UNWNaz4r.c:2: error: for each function it appears in.)ERROR: opencl not found
我已经 。
查找一下opencl的库,是存在的。
[root@localhost OpenCL]# whereis libOpenCLlibOpenCL: /usr/lib64/libOpenCL.so
[root@localhost lib64]# pwd/usr/lib64[root@localhost lib64]# ll *Open*lrwxrwxrwx. 1 root root 14 May 8 11:03 libOpenCL.so -> libOpenCL.so.1lrwxrwxrwx. 1 root root 16 May 8 11:03 libOpenCL.so.1 -> libOpenCL.so.1.0lrwxrwxrwx. 1 root root 18 May 8 11:03 libOpenCL.so.1.0 -> libOpenCL.so.1.0.0-rwxr-xr-x. 1 root root 21296 May 8 11:03 libOpenCL.so.1.0.0lrwxrwxrwx. 1 root root 20 May 7 16:16 libQtOpenGL.so.4 -> libQtOpenGL.so.4.6.2lrwxrwxrwx. 1 root root 20 May 7 16:16 libQtOpenGL.so.4.6 -> libQtOpenGL.so.4.6.2-rwxr-xr-x. 1 root root 800288 Sep 26 2011 libQtOpenGL.so.4.6.2
OK,确认库是存在的,但没有头文件。将cuda提供的opencl的头文件copy为/usr/include/OpenCL和/usr/include/CL 。
而后呢, 编译发现版本冲突, ffmpeg需要1.2版本。。。
"ERROR: opencl must be installed and version must be 1.2 or compatible"
下载1.2版本()的opencl替换原来的版本,然后就编译成功了。(编译增加-lOpenCL)
测试一下:
[root@localhost test]# ./ffmpeg -opencl_benchffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers built on May 10 2014 11:26:51 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4) configuration: --prefix=/root/20130423/_release --cc= --extra-cflags=-I/root/20130423/_release/include --extra-ldflags='-L/root/20130423/_release/lib -lm' --enable-pthreads --extra-libs=-lpthread --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libaacplus --enable-postproc --enable-demuxer=oss --disable-debug --enable-nonfree --enable-static --enable-version3 --enable-opencl libavutil 52. 66.100 / 52. 66.100 libavcodec 55. 52.102 / 55. 52.102 libavformat 55. 33.100 / 55. 33.100 libavdevice 55. 10.100 / 55. 10.100 libavfilter 4. 2.100 / 4. 2.100 libswscale 2. 5.102 / 2. 5.102 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100platform_idx device_idx device_name runtime0 1 Tesla K10.G1.8GB 17190 0 Tesla K10.G1.8GB 1723