[Libav-user] compiling ffmpeg with -fPIC

Zanelli Franco fzanelli at tecnosens.it
Mon Oct 28 14:20:52 CET 2013

I'd like to make a shared library called mylib.so that include static ffmpeg libraries libavcodec.a libavformat.a ..etc. in order to have just one shared library
I'm working on a linux machine 64 bit (ubuntu 12.04).
I've built ffmpeg libraries from ffmpeg 2.0.1 sources with this configuration:
--prefix="$HOME/ffmpeg_build"   --extra-cflags="-m64 -I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib"   --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libmp3lame --enable-libx264 --enable-pic

When I link the avlibs in mine, with this command:
gcc -m64    -o mylib.so  -L../ffmpeg_build/lib /home/uts/ffmpeg_build/lib/libavcodec.a -Wl,-R. -shared -s -fPIC

I always get this error:
/usr/bin/ld: /home/uts/ffmpeg_build/lib/libavcodec.a(deinterlace.o): relocation R_X86_64_PC32 against symbol `ff_pw_4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

The same procedure on a x86 linux platform succeded.
This is the same problem experienced from Dayana in this mailing list the 1st may 2013, I read the answers but they were not helpful
Can you help me please?

thank you

Il 28/10/2013 12:37, Carl Eugen Hoyos ha scritto:

	Zanelli Franco <fzanelli at ...> <mailto:fzanelli at ...>  writes:
	> I experienced it when I was trying to include static ffmpeg
	> libraries (libavcodec.a, libavformat.a ...) in my shared lib
	> (mylib.so) on a 64 bit linux platform, but I don't know how to
	> solve, can you help me please?
	Could you explain (FFmpeg version, configure line, etc.)
	how to reproduce your problem? That may allow us to help.
	Carl Eugen
	Libav-user mailing list
	Libav-user at ffmpeg.org



Ing. Franco Zanelli
Sviluppo Software - Divisione Sistemi Videosorveglianza 
Software Engineer - Videosecurity System Division 

Via Vergnano, n.16, 25125 BRESCIA - ITALIA
Tel: +39 030.3534144 Fax: +39 030.3530815
Email: fzanelli at tecnosens.it
Web: http://www.tecnosens.it <http://www.tecnosens.it/>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131028/d24ae73b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: immagini1
Type: image/png
Size: 8557 bytes
Desc: immagini1
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131028/d24ae73b/attachment.png>

More information about the Libav-user mailing list