[Libav-user] compiling ffmpeg with -fPIC

Dayana dribas at cenatav.co.cu
Mon May 6 17:04:29 CEST 2013


I am a little confused, do you get this error when you are trying to use 
libavcodec.a into another of your projects or during compilation of 
libavcodec itself? In the latter case why are you building a static 
library (i.e. libavcodec.a instead of a libavcodec.so ) ? You need to 
build libavcodec as a shared object library by specifying 
--enable-shared --disable-static  or something to that effect


I get the 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

when Im trying to use the function av_register_all(), belonging to 
libavcodec, in a library that I am programing (libmylibrary.so)

For compiling libavcodec, I am doing ./configure, make, make install in 
the directory of ffmpeg-0.11.1, wish contains libavcodec, libavutil, 
etc... the result of this is libavcodec.a, libavutil.a, etc...

:)





On 05/06/2013 10:56 AM, Ratin wrote:
>
>
>
> On Mon, May 6, 2013 at 6:18 AM, Dayana <dribas at cenatav.co.cu 
> <mailto:dribas at cenatav.co.cu>> wrote:
>
>     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...
>
>
>
>
>
>
> I am a little confused, do you get this error when you are trying to 
> use libavcodec.a into another of your projects or during compilation 
> of libavcodec itself? In the latter case why are you building a static 
> library (i.e. libavcodec.a instead of a libavcodec.so ) ? You need to 
> build libavcodec as a shared object library by specifying 
> --enable-shared --disable-static  or something to that effect
>
>
>
>
>
>
>     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
>
>
>     _______________________________________________
>     Libav-user mailing list
>     Libav-user at ffmpeg.org <mailto:Libav-user at ffmpeg.org>
>     http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130506/5b09fe78/attachment.html>


More information about the Libav-user mailing list