LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-09-2013, 07:53 PM   #1
cowmoo32
Member
 
Registered: May 2007
Posts: 49

Rep: Reputation: 0
Installing OpenCV - recompile with -fPIC?


Ubuntu 13.04 - fresh install, I installed for the sole purpose of working out any kinks when installing OpenCV.

Following the guide here for OpenCV:
http://opencv.willowgarage.com/wiki/FFMPEG

And here for ffmpeg,x264, and some other requirements
https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide

I had no errors in any of the installs, until I ran make for OpenCV

Code:
[ 10%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/bin/ld: /home/user/ffmpeg_build/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/user/ffmpeg_build/lib/libavcodec.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.6] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
I have searched around and have found a few mentions of changing the make file, but they weren't specific to OpenCV. I ran into the same error in Mint 15 as well, which is why I installed Ubuntu, hoping that would fix my problem.

I came across a post here that says

" After building both x264 and ffmpeg with --enable-pic and --extra-cflags=-fPIC options, they both seem to work just fine."

so I tried but now I'm getting an error saying that no working C compiler is found, yet GCC shows up as version 4.7.3. I'm at a dead end here.

Last edited by cowmoo32; 09-09-2013 at 10:21 PM.
 
Old 09-10-2013, 03:18 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
you are relocating a lib "libavcodec"
are you planning on having this the NEW permanent install location for the lib ?
" /home/user/ffmpeg_build/lib"

i would have that installed to the 32 bit /usr/lib
 
Old 09-10-2013, 06:04 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
no working C compiler is found
Solution : $ sudo apt-get install g++ build-essential


Quote:
.... installing OpenCV
HOW TO install OpenCV : $ sudo apt-get install libopencv-dev
.. which will provide version "2.4.2+dfsg-0exp2ubuntu1"
+ all the dependencies listed here
http://packages.ubuntu.com/raring/libopencv-dev
+ the inter-dependencies for all the above packages.


Quote:
...///libavcodec.a: could not read symbols: Bad value
Installing an ffmpeg that is compiled with shared libs (libavcodec.so etc.)
$ sudo apt-get install libavcodec-dev libavdevice-dev libavfilter-dev \
libavformat-dev libavutil-dev libpostproc-dev libswscale-dev

-
 
Old 09-10-2013, 10:35 AM   #4
cowmoo32
Member
 
Registered: May 2007
Posts: 49

Original Poster
Rep: Reputation: 0
I haven't fixed it on my own machine, but on another new-ish Ubuntu 13.04 machine I got it to compile without errors following the instructions here http://karytech.blogspot.com/2012/05...untu-1204.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
recompile with -fPIC packets Linux - Software 7 07-15-2011 04:43 AM
recompile with -fPIC coveykw@netscape.net *BSD 9 03-19-2010 10:08 AM
Can someone help me understand how to fix my recompile with -fPIC error ? Bascom49 Linux - Software 3 12-26-2009 05:57 AM
Error recompile with fPIC, but fPIC is already as a compilation option eolmsan Linux - Software 4 12-03-2008 11:05 AM
What does 'recompile with -fPIC' mean cocteau Linux - Software 1 03-31-2005 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration