Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 304

Fixing libavcodec.a linking error during build

$
0
0
I initially built `opencv` in my `~/opt/` directory with no issues, but then experienced errors using ` cv2.VideoCapture()` via the python bindings. [This SO answer](http://stackoverflow.com/a/11465097/943773) led me to rebuild `ffmpeg`, after which I tried to rebuild `opencv` in my root `/opt/` directory. I got the following error, and I can't seem to figure out what is causing this. Any suggestions? Thanks for the help! [ 18%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_ffmpeg.cpp.o In file included from /opt/opencv/modules/videoio/src/cap_ffmpeg.cpp:45:0: /opt/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)’: /opt/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:2230:41: warning: ignoring return value of ‘int avformat_write_header(AVFormatContext*, AVDictionary**)’, declared with attribute warn_unused_result [-Wunused-result] avformat_write_header(oc_, NULL); ^ Linking CXX shared library ../../lib/libopencv_videoio.so /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 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

Viewing all articles
Browse latest Browse all 304

Trending Articles