[Libav-user] compiling ffmpeg with -fPIC

Dayana dribas at cenatav.co.cu
Mon May 6 15:18:58 CEST 2013


Hi Gavin!!

I set

-shared -Wl,-Bsymbolic

in the linker flags of my library, that depends of libavcodec, libavutil, libavformat...

However when Im going to call av_register_all(); I get the same error:
/usr/local/lib/libavcodec.a(lpc_mmx.o): relocation R_X86_64_PC32 against
symbol `ff_pd_1' can not be used when making a shared object; recompile
with -fPIC

///////

I think that I have to set the flag -fPIC for compiling the libavcodec, libavutil, libavformat, so I added: enable pic , in the configure file of the ffmpeg project:

# OS specific
case $target_os in
linux)
         add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
	enable pic
	enable dv1394


Therefore when ffmpeg is compiled, libavcodec, libavutil, libavformat were compiled with -fPIC.... then when should be ok If I want to use them in my libx.so ... but It is not, I have the same error:

/usr/local/lib/libavcodec.a(lpc_mmx.o): relocation R_X86_64_PC32 against
symbol `ff_pd_1' can not be used when making a shared object; recompile
with -fPIC


I dont know wish is the problem with ffmpeg and -fPIC...

   







On 05/03/2013 06:32 AM, Gavin Kinsey wrote:
> On Wednesday 01 May 2013 15:41:48 Dayana wrote:
>> Hi!!! Im developing an aplication using libavcodec, libavformat and
>> libavutil. Im trying to make a shared library and for that I have to get
>> libavs compiled with -fPIC ... I was trying to do it by setting
>> --enable-pic in the configure file, however Im still have the same error:
>>
>> /usr/local/lib/libavcodec.a(lpc_mmx.o): relocation R_X86_64_PC32 against
>> symbol `ff_pd_1' can not be used when making a shared object; recompile
>> with -fPIC
> If you are trying to combine several ffmpeg libraries into a single shared
> library as I have seen some apps try to do then you need to use the
> following linker flag on the final library build step.
>
> -shared -Wl,-Bsymbolic
>



More information about the Libav-user mailing list