[Libav-user] compiling ffmpeg with -fPIC

Chung Leong cleong at cal.berkeley.edu
Mon May 6 18:42:12 CEST 2013


> Date: Mon, 6 May 2013 09:18:58 -0400
> From: dribas at cenatav.co.cu
> To: libav-user at ffmpeg.org
> Subject: Re: [Libav-user] compiling ffmpeg with -fPIC
> 
> 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...

Hello, I'm new to the list.
If you want to link objects in a static library into a shared library, I think you need to compile the static library using -mcmode=large. As .so can be loaded at an address above 4gig, 32-bit code pointers don't work. The linker can neither create 64-bit relocations from 32-bit relocations or change function calls from non-PIC to PIC. So it throws an error.
Someone correct me if I'm wrong. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130506/896b6fcd/attachment.html>


More information about the Libav-user mailing list