在树莓派3上构建opencv时出错

时间:2016-10-07 01:49:08

标签: opencv raspberry-pi

我正在关注this example,并在运行make

时收到以下错误消息
In file included from /root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg.cpp:45:0:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)’:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2207: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/libx264.a(common.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libx264.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:215: recipe for target 'lib/libopencv_videoio.so.3.1.0' failed
make[2]: *** [lib/libopencv_videoio.so.3.1.0] Error 1
CMakeFiles/Makefile2:4058: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2

1 个答案:

答案 0 :(得分:1)

我已按照链接http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/

中的步骤在Raspberry Pi 3上成功安装了opencv

我在执行这些步骤时所做的更改是:

  1. 使用'aptitude'代替'apt-get'并接受所有给出的建议
  2. 在执行步骤11之前,请运行'source~ / .profile'。要退出,请运行“停用”
  3. 希望这会有所帮助:)