ubuntu14.04安装opencv2.4.13报错 -fPIC
Posted lzq031
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubuntu14.04安装opencv2.4.13报错 -fPIC相关的知识,希望对你有一定的参考价值。
很久之前装caffe的时候需要编译opencv就报错了、usr/local/lib/libavcodex.a(***.o) relocation。。。。。recompile with -fPIC
现在又要装今天又搞了一天:( 还搜了一堆静态库的问题,后来发现这些都是ffmpeg的问题,然后还是在ffmpeg的编译问题下面找到答案。一般都是说什么configure设置一下神马的
就是这个!指路明灯!(http://answers.opencv.org/question/63331/opencv-30-wont-compile-with-ffmpeg-support/)
The short answer is, I recompiled ffmpeg with additional flags --enable-pic
and --extra-ldexeflags=-pie
, and then had to edit a particular option in my OpenCV build. I used ccmake to set CMAKE_SHARED_LINKER_FLAGS
to a value of -Wl,-Bsymbolic
, as described by the ffmpeg website.
Hopefully this helps you out, Rex. Best of luck!
Ok but seriously, this took me a while to find the answer, so hopefully this will help save somebody a couple hours of pain.
哈哈哈感谢作者但是光是找这个答案就已经有a couple hours of pain了好嘛!!TT
我的解决办法:下载ffmpeg的tar包,然后安装的时候 CFLAGS=-fPIC ./configure --enable-shared --enable-pic --extra-ldexeflags=-pie --prefix=/usr/local/ffmpeg
在make&make install之后就会在/usr/local/ffmpeg文件夹下面生成这些总是报错的libav*.a文件, 用这些文件替换掉usr/local/lib/下面的libav*.a文件,再重新编译opencv
终于编译成功了!!!!!!!!!!!!!!!!不过这还只是第一步TT 感脚后面还有无数个大坑TT
以上是关于ubuntu14.04安装opencv2.4.13报错 -fPIC的主要内容,如果未能解决你的问题,请参考以下文章