[FFmpeg-trac] #7130(avcodec:new): Android compilation broken with FFmpeg 3.4.2
FFmpeg
trac at avcodec.org
Tue Apr 10 00:32:22 EEST 2018
#7130: Android compilation broken with FFmpeg 3.4.2
-----------------------------------+---------------------------------------
Reporter: donturner | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-----------------------------------+---------------------------------------
Summary of the bug:
When compiling FFmpeg 3.4.2 for Android using the latest version of the
Android NDK (16.1.4479499) the following error is produced:
libavcodec/aaccoder.c: In function 'search_for_ms':
libavcodec/aaccoder.c:803:25: error: expected identifier or '(' before
numeric constant
int B0 = 0, B1 = 0;
How to reproduce:
- Download the Android NDK from:
https://developer.android.com/ndk/downloads/index.html
- Set an environment variable ANDROID_NDK to the NDK root directory
- Download FFmpeg 3.4.2 source
- Use the following bash script to configure the build:
#!/bin/bash
PLATFORM=${ANDROID_NDK}/platforms/android-16/arch-arm
./configure \
--prefix=build/armeabi-v7a \
--target-os=linux \
--arch=arm \
--cc=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-
x86_64/bin/arm-linux-androideabi-gcc \
--nm=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-
x86_64/bin/arm-linux-androideabi-nm \
--strip=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt
/darwin-x86_64/bin/arm-linux-androideabi-strip \
--cross-prefix=arm-linux-androideabi- \
--extra-libs="-lgcc" \
--sysroot=${ANDROID_NDK}/sysroot \
--extra-cflags="-I${ANDROID_NDK}/sysroot/usr/include/arm-linux-
androideabi" \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib
-nostdlib -lc -lm -ldl -llog" \
--enable-cross-compile \
--enable-small \
--disable-programs \
--disable-doc \
--enable-shared \
--disable-static
Then execute:
make
Expected outcome:
FFmpeg compiles without error
Actual outcome:
The following error is produced:
libavcodec/aaccoder.c: In function 'search_for_ms':
libavcodec/aaccoder.c:803:25: error: expected identifier or '(' before
numeric constant
int B0 = 0, B1 = 0;
The problem seems to be a name clash with #define B0 in
$ANDROID_NDK/sysroot/usr/include/asm-generic/termbits.h
Here's a blog post from someone experiencing the same issue:
https://medium.com/@piyush1995bhandari/cross-compiling-ffmpeg-for-android-
545a1cfca31e
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7130>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list