Ask Your Question

Revision history [back]

WARNING: Can't build ffmpeg test code

Hello all

Several hours now spent for still cannot use opencv with mp4 files... on Zesty

I compiled FFMPEG from git with options:

./configure   --prefix="$HOME/ffmpeg_build"   --pkg-config-flags="--static"   --extra-cflags="-I$HOME/ffmpeg_build/include"   --extra-ldflags="-L$HOME/ffmpeg_build/lib"   --extra-libs="-lpthread -lm"   --bindir="$HOME/bin"   --enable-gpl   --enable-libass   --enable-libfdk-aac   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libtheora   --enable-libvorbis   --enable-libvpx   --enable-libx264   --enable-libx265   --enable-nonfree --enable-pic --enable-avresample

Then I modified opencv cmake/OpenCVFindLibsVideo.cmake:239 in order to check for FFMPEG fatal compilation errors and I got :

 make[1]: Entering directory
  '/home/guilmort/opencv-3.3.1/build/CMakeFiles/CMakeTmp'

  Building CXX object CMakeFiles/cmTC_846ee.dir/ffmpeg_test.cpp.o

  /usr/bin/c++ -I/usr/local/include -I/home/guilmort/ffmpeg_build/include
  -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor
  -Werror=address -Werror=sequence-point -Wformat -Werror=format-security
  -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow
  -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing
  -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option
  -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -msse
  -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG
  -o CMakeFiles/cmTC_846ee.dir/ffmpeg_test.cpp.o -c
  /home/guilmort/opencv-3.3.1/cmake/checks/ffmpeg_test.cpp

  Linking CXX executable cmTC_846ee

  /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_846ee.dir/link.txt
  --verbose=1

  /usr/bin/c++ -fsigned-char -W -Wall -Werror=return-type
  -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat
  -Werror=format-security -Wmissing-declarations -Wundef -Winit-self
  -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self
  -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment
  -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer
  -ffunction-sections -msse -msse2 -msse3 -fvisibility=hidden
  -fvisibility-inlines-hidden -O3 -DNDEBUG
  CMakeFiles/cmTC_846ee.dir/ffmpeg_test.cpp.o -o cmTC_846ee -L/usr/local/lib
  -L/home/guilmort/ffmpeg_build/lib
  -Wl,-rpath,/usr/local/lib:/home/guilmort/ffmpeg_build/lib -rdynamic
  -lavformat -lxcb -lX11 -lm -llzma -lz -lavcodec -lswresample -lswscale
  -lavutil -lva -lva-drm -lva-x11 -lvdpau

  /usr/bin/ld: /usr/local/lib/libavformat.a(utils.o): relocation R_X86_64_32
  against `.rodata.str1.1' can not be used when making a shared object;
  recompile with -fPIC

  /usr/bin/ld: /usr/local/lib/libavformat.a(avio.o): relocation R_X86_64_32
  against `.rodata.str1.1' can not be used when making a shared object;
  recompile with -fPIC

  /usr/bin/ld: /usr/local/lib/libavformat.a(aviobuf.o): relocation
  R_X86_64_32 against symbol `ffurl_context_class' can not be used when
  making a shared object; recompile with -fPIC

  /usr/bin/ld: /usr/local/lib/libavformat.a(format.o): relocation R_X86_64_32
  against `.rodata.str1.1' can not be used when making a shared object;
  recompile with -fPIC................................................

and so on for several others. Could you help to unblock this situation?

Thanks in advance. Best.