[Android] [PATCH 5/6] contrib: Disable fPIC when compiling for Android x86

Edward Wang edward.c.wang at compdigitec.com
Sun Jul 15 22:28:55 CEST 2012


---
 contrib/src/ffmpeg/rules.mak |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index ed6d8e8..d2614a5 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -81,7 +81,25 @@ endif
 
 # Linux
 ifdef HAVE_LINUX
-FFMPEGCONF += --target-os=linux --enable-pic
+FFMPEGCONF += --target-os=linux
+
+ifeq ($(ANDROID_ABI), x86)
+ifdef HAVE_ANDROID
+# Cross-compiling to Android-x86
+# Without this, you get
+# > Must specify target arch and OS when cross-compiling
+#
+# --disable-pic because Android-x86 fPIC isn't compatible with libav ASM:
+# libavcodec/x86/mpegaudiodec_mmx.c:73: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
+# libavcodec/x86/mpegaudiodec_mmx.c:73: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
+# libavcodec/x86/mpegaudiodec_mmx.c:73: error: 'asm' operand has impossible constraints
+FFMPEGCONF += --arch=x86 --disable-pic
+FFMPEG_CFLAGS += -fno-PIC
+endif # HAVE_ANDROID
+else
+FFMPEGCONF += --enable-pic
+endif
+
 endif
 
 # Windows
-- 
1.7.5.4



More information about the Android mailing list