Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在OSX上为Android编译ffmpeg_Android_Macos_Ffmpeg_Compilation - Fatal编程技术网

在OSX上为Android编译ffmpeg

在OSX上为Android编译ffmpeg,android,macos,ffmpeg,compilation,Android,Macos,Ffmpeg,Compilation,我正试图在OSX 10.12.4上为Android编译ffmpeg 以下是我遵循的步骤: 1°)编译程序包配置 从下载源代码。在pkg config文件夹中提取&cd 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°)编译ffmpeg 从下

我正试图在OSX 10.12.4上为Android编译ffmpeg

以下是我遵循的步骤:

1°)编译程序包配置

从下载源代码。在pkg config文件夹中提取&cd

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°)编译ffmpeg

从下载源代码。在ffmpeg文件夹中提取&cd

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
Make失败,出现以下错误:

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....
我可以通过将源代码中的B0和B1变量重命名为A0和A1来修复该错误(不知道为什么它会修复该问题),但是它在其他地方失败。我猜我的配置有问题,我更愿意避免修补源代码

因此,问题是:

  • 有人知道这里出了什么问题吗?我需要给gcc一些参数吗
  • --target os=linux是正确的,还是应该--target os=darwin?目标操作系统是完成编译的操作系统,还是执行ffmpeg的操作系统?通过使用darwin,我可以使用--enable static而不是--enable shared(我想要的)进行编译

注意:我需要自己编译它,因为我只想要一个支持HTTPS的arm版本。因此,我无法使用现有的构建版本。

我在尝试构建最新版本的ffmpeg 3.4时也遇到了这个问题。我希望您可以尝试3.3版本。我成功构建了它。 我怀疑最新的版本是不稳定的,并且有一些bug。 顺便说一下,你可以从这篇文章中得到一些答案:

--target os=android
解决了这个问题

./configure \ 
... 
--target-os=android 

看来我忘了回答我自己的问题,所以我接受你的。我和你做了同样的事情,并采用了一个旧版本,它正在运行。为此浪费了这么多时间——!——!!!