J'essaye de compiler ffmpeg pour Android, sur OSX 10.12.4.Compilation ffmpeg pour Android sur OSX
Voici les étapes que je suivais:
1 °) Compile pkg-config
Téléchargez les sources de here. Extrait & & cd dans le dossier pkg-config.
export DST=/a/path/on/my/computer
./configure --with-internal-glib --prefix=$DST --exec-prefix=$DST
make -j2
make install
export PATH=$PATH:$DST/bin
2 °) Compile ffmpeg
Téléchargez les sources de here. Extrait & & cd dans le dossier ffmpeg.
export NDK=/path/to/android-ndk-r15c
export PLATFORM_VERSION=android-26
export ARCH=arm
export PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH
export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
export PREFIX=$(pwd)/android/$ARCH
export ADDI_CFLAGS="-Os -fpic -marm"
export ADDI_CONFIGURE_FLAG=""
export ADDI_LDFLAGS=""
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-symver \
--disable-avdevice \
\
--pkg-config=pkg-config \
\
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=$ARCH \
--enable-cross-compile \
--sysroot=$PLATFORM \
--extra-cflags="$ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
\
$ADDI_CONFIGURE_FLAG
make -j2
Marque échoue avec l'erreur suivante:
AR libavfilter/libavfilter.a
AR libavformat/libavformat.a
CC libavcodec/aaccoder.o
In file included from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm/termbits.h:19:0,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm-generic/termios.h:21,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/asm/termios.h:19,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/linux/termios.h:22,
from /Users/Tim/Library/Android/android-ndk-r15c/platforms/android-26/arch-arm/usr/include/sys/ioctl.h:37,
from ./libavutil/timer.h:36,
from ./libavutil/internal.h:42,
from ./libavutil/common.h:467,
from libavcodec/mathops.h:27,
from libavcodec/aaccoder.c:38:
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;
^
libavcodec/aaccoder.c:865:28: error: lvalue required as left operand of assignment
B0 += b1+b2;
^
libavcodec/aaccoder.c:866:25: error: 'B1' undeclared (first use in this function)
B1 += b3+b4;
^
libavcodec/aaccoder.c:866:25: note: each undeclared identifier is reported only once for each function it appears in
make: *** [libavcodec/aaccoder.o] Error 1
make: *** Waiting for unfinished jobs....
Je suis en mesure de corriger cette erreur en renommant variables & B0 B1 dans la source à A0 & A1 (ne sais pas pourquoi il fixe le problème), mais il échoue ailleurs. Je suppose que quelque chose ne va pas dans ma config, et je préfère éviter d'avoir à patcher la source.
Ainsi, les questions sont les suivantes:
- ce que quelqu'un sait ce qui ne va pas ici? Dois-je donner des args à gcc?
- est le --target-os = linux correct, ou devrait-il être --target-os = darwin? Est-ce que target-os est le système d'exploitation où la compilation est faite, ou où ffmpeg sera exécuté? En utilisant darwin, je peux compiler en utilisant --enable-static, mais pas --enable-shared (que je veux).
Note: J'ai besoin de le compiler moi-même car je ne veux qu'une version de bras, avec le support HTTPS. Donc je ne peux pas utiliser les versions construites existantes.
On dirait que j'ai oublié de répondre à ma propre question, alors je vais accepter le vôtre. J'ai fait la même chose que vous et j'ai pris une version plus ancienne, qui fonctionne. Tant de temps perdu pour ça -_- !!! –