Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recompile with -fPIC

I was trying to reinstall my ffmpeg, following this guide, on my ARM Ubuntu machine. Unfortunately, when I compile a program which uses this lib I get the following failure:

/usr/bin/ld: /usr/local/lib/libavcodec.a(amrnbdec.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/libavcodec.a: could not read symbols: Bad value collect2: ld returned 1 exit status 

Now I would like to recompile it with -fPIC like the compiler is suggesting but I have no idea how. Any help is appreciated.

like image 728
user1455085 Avatar asked Dec 11 '12 01:12

user1455085


People also ask

What does recompile with Xlint mean?

By "recompile with -Xlint", the compiler means to inform you that you need to recompile your program like this: javac -Xlint abc.java. If you do so, the compiler will tell you which methods are deprecated so you can remove your calls to them.

How do I recompile with Xlint unchecked for details?

Note: Recompile with -Xlint:unchecked for details. How do I recompile with -Xlint:unchecked ? Are you compiling on the command line? If so, add the -Xlint:unchecked to the command line you're executing, just as the message indicates.

What is Xlint in Java?

The javac -Xlint options control warnings for all files compiled in a particular run of javac . You may have identified specific locations in source code that generate warnings that you no longer want to see. You can use the @SuppressWarnings annotation to suppress warnings whenever that code is compiled.


1 Answers

Briefly, the error means that you can't use a static library to be linked w/ a dynamic one. The correct way is to have a libavcodec compiled into a .so instead of .a, so the other .so library you are trying to build will link well.

The shortest way to do so is to add --enable-shared at ./configure options. Or even you may try to disable shared (or static) libraries at all... you choose what is suitable for you!

like image 70
zaufi Avatar answered Oct 05 '22 11:10

zaufi