Re: [Libav-user] compiling ffmpeg with -fPIC

2013-05-06 Thread Chung Leong
Let me correct myself. The problematic symbol in the situation here is 
"ff_pd_1", a global variable. It's declared with the attribute 
visibility("hidden"). The symbol isn't exported. Knowing this, gcc apparently 
doesn't generate PIC code for accessing it even when you add -fPIC.
By default, gcc assumes your executable isn't going to be larger than 2 gig. 
Executables are normally loaded within the first 2 gig of the address space, so 
any global variable ought to be reachable by a 32-bit address.  This doesn't 
work for shared libraries. The address needs to be 64-bit.  
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] compiling ffmpeg with -fPIC

2013-05-06 Thread Chung Leong
> Date: Mon, 6 May 2013 09:18:58 -0400
> From: dri...@cenatav.co.cu
> To: libav-user@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.  ___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user