Problem with Cross Compiling OpenCV for Xilinx Zynq – ARM with FFmpeg on Ubuntu Linux OS

Problem:

I followed the instructions mentioned by Xilinx at http://www.wiki.xilinx.com/OpenCV+Installation in order to cross compile the OpenCV-2.4.9 with FFmpeg for Xilinx Zynq Platform on Ubuntu 14.04.

While configuring the FFmpeg, it gave me the following warning:

“WARNING: arm-xilinx-linux-gnueabi-pkg-config not found, library detection may fail.”

The FFmpeg did compile ok and generated all the necessary SO files however as a result of the warning when I tried to build the OpenCV-2.4.9, I got errors that libavcodec.so.56, libavformat.so.56 etc FFmpeg libraries are not found.

Following errors while build takes place :

/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: warning: libswresample.so.1, needed by opencv/ffmpeg-2.7.1/lib/libavcodec.so.56, not found (try using -rpath or -rpath-link)
opencv/ffmpeg-2.7.1/lib/libavcodec.so.56: undefined reference to `swr_close@LIBSWRESAMPLE_1′

/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-linux-gnueabi/4.8.3/../../../../arm-xilinx-linux-gnueabi/bin/ld: warning: libswscale.so.3, needed by ../../lib/libopencv_highgui.so.2.4.9, not found (try using -rpath or -rpath-link)
../../lib/libopencv_highgui.so.2.4.9: undefined reference to `avcodec_decode_video2@LIBAVCODEC_56′

Solution:

The way I have manged to resolve this and successfully cross compile OpenCV is by manually copying the SO libs from FFmpeg/lib folder to the OpenCV/build/lib directory and then rerunning the make. After this OpenCV was successfully built.