title: OpenCv 3.1.0 - compile fails
body: <p>I'm trying to install OpenCv  3.1.0 on debian 8 (it provides python3 bindings)</p>
  
  <p>following the standard procedure on the official site <a href="http://docs.opencv.org/3.1.0/d7/d9f/tutorial_linux_install.html" rel="nofollow noreferrer">http://docs.opencv.org/3.1.0/d7/d9f/tutorial_linux_install.html</a>   the process  fails</p>
  
  <pre><code>[ 30%] Building CXX object modules/photo/CMakeFiles/opencv_photo.dir/opencl_kernels_photo.cpp.o
  Linking CXX shared library ../../lib/libopencv_shape.so
  [ 30%] Built target opencv_shape
  Linking CXX shared library ../../lib/libopencv_photo.so
  [ 30%] Built target opencv_photo
  Makefile:147: recipe for target 'all' failed
  make: *** [all] Error 2
  [  0%] Built target opencv_core_pch_dephelp
  [  0%] Built target pch_Generate_opencv_core
  [  4%] Built target opencv_core
  [  4%] Built target opencv_ts_pch_dephelp
  [  4%] Built target pch_Generate_opencv_ts
  [  4%] Built target opencv_imgproc_pch_dephelp
  [  4%] Built target pch_Generate_opencv_imgproc
  [  9%] Built target opencv_imgproc
  [  9%] Built target opencv_imgcodecs_pch_dephelp
  [  9%] Built target pch_Generate_opencv_imgcodecs
  [ 11%] Built target opencv_imgcodecs
  [ 11%] Built target opencv_videoio_pch_dephelp
  [ 11%] Built target pch_Generate_opencv_videoio
  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
  modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:280: recipe for target 'lib/libopencv_videoio.so.3.1.0' failed
  make[2]: *** [lib/libopencv_videoio.so.3.1.0] Error 1
  CMakeFiles/Makefile2:4076: 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
  </code></pre>
  
  <p><strong>more info about this issue at <a href="http://wiki.open-si.org/trac-notes/ticket/10" rel="nofollow noreferrer">http://wiki.open-si.org/trac-notes/ticket/10</a></strong></p>