Ask Your Question

Revision history [back]

Cannot compile OpenCV 3.1.0 with FFMPEG using shared libraries in Centos 7

Hello,

I am trying to compile OpenCV 3.1.0 with FFmpeg with Centos 7, and I'm getting the following error:

Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/include/../lib/libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_videoio.so.3.1.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2

I compiled FFmpeg with the following build script: http://pastebin.com/B1xDTJtF

I have tried the build script with and without the --enable-static and --enable-shared flags, and all of the results appear to be similar. Although, I could be (and probably am) missing something extremely important.