简体   繁体   English

使用Bambuser源的Android-NDK构建

[英]Android-NDK building using the Bambuser source

I am trying to use the FFmpeg source provided by the Bambuser. 我正在尝试使用Bambuser提供的FFmpeg源代码。

However, I am fail to build the files 但是,我无法构建文件

I get the following error: 我收到以下错误:

arm-linux-androideabi-gcc is unable to create an executable file. arm-linux-androideabi-gcc无法创建可执行文件。 C compiler test failed. C编译器测试失败。

I have already set the NDK path to /home/android-ndk but still get this error 我已经将NDK路径设置为/ home / android-ndk但仍然出现此错误

And I am using Android-NDK-r5b 我正在使用Android-NDK-r5b

can anyone help? 有人可以帮忙吗? THX 谢谢

Here is my build.sh 这是我的build.sh

#!/bin/bash

if [ "$NDK" = "" ]; then
    echo NDK variable not set, assuming ${HOME}/android-ndk
    export NDK=${HOME}/android-ndk
fi

SYSROOT=$NDK/platforms/android-3/arch-arm
# Expand the prebuilt/* path into the correct one
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows`
export PATH=$TOOLCHAIN/bin:$PATH

rm -rf build/ffmpeg
mkdir -p build/ffmpeg
cd ffmpeg

# Don't build any neon version for now
for version in armv5te armv7a; do

    DEST=../build/ffmpeg
    FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm"
    FLAGS="$FLAGS --sysroot=$SYSROOT"
    FLAGS="$FLAGS --soname-prefix=/data/data/com.streaming.realive/lib/"
    FLAGS="$FLAGS --enable-shared --disable-symver"
    FLAGS="$FLAGS --enable-small --optimization-flags=-O2"
    FLAGS="$FLAGS --enable-encoder=mpeg4 --enable-decoder=mpeg4"
    FLAGS="$FLAGS --enable-encoder=mpeg2video --enable-encoder=nellymoser"
    FLAGS="$FLAGS --enable-protocol=rtp --enable-protocol=rtmp"
    FLAGS="$FLAGS --enable-protocol=http --enable-protocol=tcp --enable-protocol=udp"
    FLAGS="$FLAGS --enable-protocol=file"

    case "$version" in
        neon)
            EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
            EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
            # Runtime choosing neon vs non-neon requires
            # renamed files
            ABI="armeabi-v7a"
            ;;
        armv7a)
            EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
            EXTRA_LDFLAGS=""
            ABI="armeabi-v7a"
            ;;
        *)
            EXTRA_CFLAGS=""
            EXTRA_LDFLAGS=""
            ABI="armeabi"
            ;;
    esac
    DEST="$DEST/$ABI"
    FLAGS="$FLAGS --prefix=$DEST"

    mkdir -p $DEST
    echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" > $DEST/info.txt
    ./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" | tee $DEST/configuration.txt
    [ $PIPESTATUS == 0 ] || exit 1
    make clean
    make -j4 || exit 1
    make install || exit 1

done

First which platform u use? 首先 u使用哪个平台? I suggest Ubuntu. 我建议Ubuntu。

Second make sure NDK path is correct. 第二,确保NDK路径正确。

Third FLAGS="$FLAGS --soname-prefix=/data/data/com.streaming.realive/lib/" 第三个 FLAGS="$FLAGS --soname-prefix=/data/data/com.streaming.realive/lib/"

maybe you need to create the relative folder in your computer 也许您需要在计算机中创建相关文件夹

here my config.log I also get the same issue when using bambuser script. 这里我的config.log在使用bambuser脚本时我也遇到了同样的问题。 I using ubuntu 我用的是ubuntu

type mktemp
mktemp is /bin/mktemp
WARNING: Unknown C compiler arm-linux-androideabi-gcc, unable to select optimal CFLAGS
check_ld
check_cc
BEGIN /tmp/ffconf.ItYaeeJM.c
    1   int main(void){ return 0; }
END /tmp/ffconf.ItYaeeJM.c
arm-linux-androideabi-gcc -c -o /tmp/ffconf.woaTRE0T.o /tmp/ffconf.ItYaeeJM.c
./configure: 572: ./configure: arm-linux-androideabi-gcc: not found
C compiler test failed.

First check your configure.log file in the ffmpeg directory. 首先检查ffmpeg目录中的configure.log文件。 In that the last few lines indicates the exact error you face. 最后几行表示您面临的确切错误。 If you post that error, we might be able to help you. 如果您发布该错误,我们可能会帮助您。

If you are on Windows Operating System then, try to add your toolchain path (used in build.sh ) to the PATH environmental variable (from My Computer 's properties). 如果您使用的是Windows操作系统,请尝试将工具链路径(在build.sh )添加到PATH环境变量(来自“ My Computer ”的属性)。

For Example: 例如:

C:\android-ndk-r7\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin

Try this. 尝试这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM