使用Android-NDK-16.1构建FFMPEG-3.4时出错 [英] Error in building FFMPEG-3.4 with Android-NDK-16.1

查看:475
本文介绍了使用Android-NDK-16.1构建FFMPEG-3.4时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Android-NDK-16.1编译FFMPEG-3.4.

Trying to compile the FFMPEG-3.4 with Android-NDK-16.1.

在Mac上编译源代码.

Compiling the source on Mac.

获得以下警告/错误:

  1. 警告:/Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-pkg-config找不到,库检测可能会失败.

  1. WARNING: /Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.

错误:在libavdevice/avdevice.c:19:0:./libavutil/avassert.h:30:20包含的文件中:致命错误:stdlib.h:没有此类文件或目录

Error: In file included from libavdevice/avdevice.c:19:0:./libavutil/avassert.h:30:20: fatal error: stdlib.h: No such file or directory

错误:/Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9 .x/include/stdint.h:9:26:致命错误:stdint.h:没有这样的文件或目录

Error: /Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory

错误:/libavutil/common.h:33:19:致命错误:errno.h:没有此类文件或目录

Error: /libavutil/common.h:33:19: fatal error: errno.h: No such file or directory

以下是用于构建的build_script.sh:

#!/bin/bash
NDK=/Users/strehan/Library/Android/sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-21/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-doc \
--disable-symver \
--enable-protocol=concat \
--enable-protocol=file \
--enable-muxer=mp4 \
--enable-demuxer=mpegts \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j3
make install
}
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
build_one

端子输出:

Enabled indevs:
lavfi

Enabled outdevs:

License: LGPL version 2.1 or later

WARNING: /Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.
config.h is unchanged
libavutil/avconfig.h is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged
GEN libavutil/libavutil.version
GEN libswscale/libswscale.version
GEN libswresample/libswresample.version
GEN libavcodec/libavcodec.version
GEN libavformat/libavformat.version
GEN libavfilter/libavfilter.version
GEN libavdevice/libavdevice.version
CC  libavdevice/alldevices.o
CC  libavdevice/avdevice.o
CC  libavdevice/lavfi.o
In file included from libavdevice/avdevice.c:19:0:
./libavutil/avassert.h:30:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.
make: *** [libavdevice/avdevice.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ./libavutil/avutil.h:296:0,
                 from ./libavutil/log.h:25,
                 from libavdevice/avdevice.h:48,
                 from libavdevice/alldevices.c:23:
./libavutil/common.h:33:19: fatal error: errno.h: No such file or directory
 #include <errno.h>
                   ^
compilation terminated.
In file included from ./libavutil/avstring.h:25:0,
                 from ./libavutil/bprint.h:27,
                 from libavdevice/lavfi.c:30:
/Users/strehan/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
 # include_next <stdint.h>
                          ^
make: *** [libavdevice/alldevices.o] Error 1
compilation terminated.
make: *** [libavdevice/lavfi.o] Error 1
INSTALL doc/examples/avio_dir_cmd.c
INSTALL doc/examples/avio_reading.c
INSTALL doc/examples/decode_audio.c
INSTALL doc/examples/decode_video.c
INSTALL doc/examples/demuxing_decoding.c
INSTALL doc/examples/encode_audio.c
INSTALL doc/examples/encode_video.c
INSTALL doc/examples/extract_mvs.c
INSTALL doc/examples/filter_audio.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/http_multiclient.c
INSTALL doc/examples/hw_decode.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/qsvdec.c
INSTALL doc/examples/remuxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/transcode_aac.c
INSTALL doc/examples/transcoding.c
INSTALL doc/examples/vaapi_encode.c
INSTALL doc/examples/README
INSTALL doc/examples/Makefile
INSTALL doc/examples/avio_dir_cmd.c
INSTALL doc/examples/avio_reading.c
INSTALL doc/examples/decode_audio.c
INSTALL doc/examples/decode_video.c
INSTALL doc/examples/demuxing_decoding.c
INSTALL doc/examples/encode_audio.c
INSTALL doc/examples/encode_video.c
INSTALL doc/examples/extract_mvs.c
INSTALL doc/examples/filter_audio.c
INSTALL doc/examples/filtering_audio.c
INSTALL doc/examples/filtering_video.c
INSTALL doc/examples/http_multiclient.c
INSTALL doc/examples/hw_decode.c
INSTALL doc/examples/metadata.c
INSTALL doc/examples/muxing.c
INSTALL doc/examples/qsvdec.c
INSTALL doc/examples/remuxing.c
INSTALL doc/examples/resampling_audio.c
INSTALL doc/examples/scaling_video.c
INSTALL doc/examples/transcode_aac.c
INSTALL doc/examples/transcoding.c
INSTALL doc/examples/vaapi_encode.c
INSTALL doc/examples/README
INSTALL doc/examples/Makefile
CC  libavdevice/alldevices.o
In file included from ./libavutil/avutil.h:296:0,
                 from ./libavutil/log.h:25,
                 from libavdevice/avdevice.h:48,
                 from libavdevice/alldevices.c:23:
./libavutil/common.h:33:19: fatal error: errno.h: No such file or directory
 #include <errno.h>
                   ^
compilation terminated.
make: *** [libavdevice/alldevices.o] Error 1

请帮助解决这些错误.由于这些错误/警告,编译将终止.

Please help to fix these errors. Due to these errors/warnings compilation is getting terminated.

注意: 即使发生这些错误,也会创建Android目录.但是我认为由于上述错误,库无法正确编译.

Note: Android directory is getting created even after these errors. But I think library is not compiled properly due to above errors.

让我知道是否还有其他需要.请帮忙.

Let me know if anything else needed. Please help.

推荐答案

您的构建脚本已过时且与现代NDK不兼容(它不遵循

Your build script is out of date and not compatible with modern NDKs (it doesn't follow https://android.googlesource.com/platform/ndk/+/master/docs/UnifiedHeaders.md#supporting-unified-headers-in-your-build-system).

我建议您省些麻烦,并使用独立工具链为您处理组织事务.

I'd recommend saving yourself some trouble and using a standalone toolchain to handle the organizational bits for you.

这篇关于使用Android-NDK-16.1构建FFMPEG-3.4时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆