[FFmpeg-devel] [PATCH] lavu/file: fix build on Android NDK with unified headers

Rodger Combs rodger.combs at gmail.com
Tue Sep 26 19:22:21 EEST 2017


I used this rather absurd configure invocation:

BINDIR=$(realpath $(dirname $(ndk-which gcc)))
NDKDIR=$(dirname $(dirname $(dirname $(dirname $(dirname $BINDIR)))))
TARGET=16
ARCH=arm
TRIPLE=arm-linux-androideabi
SUFFIX=-4.9
PLATARCH=arm

../configure \
--enable-cross-compile \
--arch=$ARCH \
--cross_prefix="$NDKDIR/toolchains/$TRIPLE$SUFFIX/prebuilt/darwin-x86_64/bin/$TRIPLE-" \
--extra-cflags=-D__ANDROID_API__=$TARGET \
--extra-cflags="--sysroot=$NDKDIR/sysroot" \
--extra-cflags="-isystem $NDKDIR/sysroot/usr/include/$TRIPLE" \
--extra-cflags="-mfloat-abi=softfp" \
--extra-ldflags="--sysroot=$NDKDIR/platforms/android-$TARGET/arch-$PLATARCH" \
--extra-ldexeflags=-pie \
--enable-debug \
--target-os=android

The issue is that the unified headers don't declare mmap() on target API versions before 21 on 32-bit platforms when __USE_FILE_OFFSET64/_FILE_OFFSET_BITS=64 is set, because this sets off_t to be off64_t, and mmap64 isn't available until API 21. This doesn't matter for ffmpeg, since we never use the offset arg anyway, so we can just declare the function ourselves.

I'm not sure what one would do about this in configure.

> On Sep 26, 2017, at 06:27, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 
> 2017-09-26 3:52 GMT+02:00 Rodger Combs <rodger.combs at gmail.com>:
> 
>> +#  if defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 21 && !defined(__LP64__)
>> +#   ifdef mmap
>> +#    undef mmap
>> +#   endif
>> +void* mmap(void*, size_t, int, int, int, __kernel_off_t);
> 
> How can this issue be reproduced?
> 
> Shouldn't this be checked in configure?
> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list