Compile error with FFMPEG (Bug #4053)
Description
I get the following error, if I compile the 3.0 beta version under linux mint 17.1 (all build tools up to date), having ffmpeg istalled:
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make2: * [lib/libopencv_videoio.so.3.0.0] Error 1
make1: [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make1: ** Waiting for unfinished jobs....
ps: (master branch also affected)
Associated revisions
Merge pull request #4053 from vpisarev:calib3d_fixes
History
Updated by Youssef Kashef almost 10 years ago
Was ffmpeg installed via apt-get? If so, can you check if any shared objects were installed under /usr/local/lib/ (e.g. /usr/local/lib/libavcodec.so).
Apt-get doesn't give you much control over how libraries are built. but there are a few things you can try:
- Building ffmpeg from source as shared objects OR as static libs with '-fPIC' in the cxxflags.
- Building OpenCV as static libs by setting -DBUILD_SHARED_LIBS=OFF in your cmake command. That way you can link to the installed ffmpeg libs.
This kind of error is generated when linking a shared object to a static lib that was built without position independent code. It's not specific to OpenCV. It can happen with any C++ library. Are any of the above solutions applicable to your situation?
Updated by Vadim Pisarevsky almost 10 years ago
that's right; I do not see how we can be sure that we link to properly built ffmpeg or not. Please, rebuild ffmpeg from source or find some alternative binary packages
- Status changed from New to Cancelled
- Category changed from highgui-video to build/install