Gavin Kinsey <[email protected]> writes: > On Tuesday 31 May 2011 13:57:08 Måns Rullgård wrote: >> Gavin Kinsey <[email protected]> writes: > <snip patch> >> > This patch breaks my Android build for ARMv7. The error message I get >> > is: >> > >> > libavutil/arm/intmath.h: In function 'av_clip_uintp2_arm': >> > libavutil/arm/intmath.h:81: warning: asm operand 2 probably doesn't >> > match constraints >> > libavutil/arm/intmath.h:81: error: impossible constraint in 'asm' >> >> The compiler isn't inlining the function properly. Get a better >> compiler. > > Until Google update the NDK that isn't an option.
You can use any compiler if you pass it the right flags. It's not even difficult. >> > This is using the Android NDK cross-compiler with the following ffmpeg >> > configure flags: >> > --disable-static --enable-shared --disable-ffmpeg --disable-ffprobe >> > --disable- ffserver --disable-avdevice --disable-avfilter >> > --enable-cross-compile -- >> > sysroot=/home/gkinsey/src-ext/android-ndk/platforms/android-8/arch-arm >> > -- target-os=linux --cross-prefix=/home/gkinsey/src-ext/android- >> > ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-l >> > inux- androideabi- --disable-symver --arch=arm-v7a >> > --extra-cflags='-march=armv7-a - mfloat-abi=softfp' >> > --extra-ldflags='-Wl,--fix-cortex-a8' --enable-debug >> >> Where did you get the idea for all those flags? > > The Android NDK documentation for the cflags and ldflags, disable-symver is > required to build ffmpeg for Android, in fact IIRC Android is the reason the > option was created. Cross compile flags are standard stuff, the rest is just > disabling crap I don't need to make the build a bit quicker. You can drop the --enable-cross-compile since that's implied by --cross-prefix, and the --arch value should be "arm". > From Android NDK doc STANDALONE-TOOLCHAIN.html > """ > If you want to target the 'armeabi-v7a' ABI, you will need ensure that the > following two flags are being used: > > CFLAGS='-march=armv7-a -mfloat-abi=softfp' That's a lie. Only the -mfloat-abi flag is required. When building libav, you should use --cpu=armv7-a, --cpu=cortex-a8 or similar to get best performance. > Note: The first flag enables Thumb-2 instructions, Another lie. > and the second one enables H/W FPU instructions while ensuring that > floating-point parameters are passed in core registers, This is actually true. > which is critical for ABI compatibility. Android uses softfloat ABI, so yes, this is true there. > Do *not* use these flags separately! Utter nonsense. > If you want to use Neon instructions, you will need one more compiler flag: > > CFLAGS='-march=armv7-a -mfloat-abi=softfp -mfpu=neon' > > Note that this forces the use of VFPv3-D32, as per the ARM specification. Enabling NEON with -mfpu=neon is probably something you do want, unless you intend to run on a Tegra2 or similar crippled device. > Also, is is *required* to use the following linker flags that routes around > a CPU bug in some Cortex-A8 implementations: > > LDFLAGS='-Wl,--fix-cortex-a8' This is not needed for libav since it doesn't use Thumb code. You should, however, use this flag when linking your main application to libav, if your app is compiled as Thumb. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
