Ask Your Question
1

Error -fPIC while compiling OpenCV

asked 2013-06-06 15:00:36 -0600

Matheus Galvez gravatar image

Hi all,

I am stumbling for the whole week in this annoying error I am getting while trying to compile OpenCV again. Some weeks ago I had compiled it correctly, but now I don't know what is happening at all.

Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: /home/matheus/ffmpeg_build/lib/../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 /home/matheus/ffmpeg_build/lib/../lib/libavcodec.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: * [lib/libopencv_highgui.so.2.4.5] Error 1 make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: ** [all] Error 2

Could anyone help me?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-06-05 12:07:10 -0600

snusmu gravatar image

it happens when your ffmpeg or h264 was built without 64bit support

check the guide at this location:

http://www.ozbotz.org/opencv-installation/

specifically parts at 7b and 8b marked IMPORTANT

you ll have to uninstall your current h264/ffmpeg and rebuild them with --enable-shared --enable-fpic flags

i had same error, and after following this guide (using most recent ffmpeg/h264/v4l versions) everything worked perfectly well

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-06 15:00:36 -0600

Seen: 3,598 times

Last updated: Jun 05 '14