Ijkplayer: 【求助!!!】使用最新的NDK16版本编译出错,在link ffmpeg阶段出错,该怎么解决?

Created on 26 Apr 2018  ·  9Comments  ·  Source: bilibili/ijkplayer

目前NDK16中已经没有android-9了,最低为android-14,所以我将do-compile-ffmpeg.sh中的FF_ANDROID_PLATFORM=android-9修改为了FF_ANDROID_PLATFORM=android-14同时修改了do-detect-env.sh中的如下代码:

IJK_NDK_REL=$(grep -o '^Pkg\.Revision.*=[0-9]*.*' $ANDROID_NDK/source.properties 2>/dev/null | sed 's/[[:space:]]*//g' | cut -d "=" -f 2)
        echo "IJK_NDK_REL=$IJK_NDK_REL"
        case "$IJK_NDK_REL" in
           #以前这里只有11-14,我的ndk是16的,所以这里加上了15和16
            11*|12*|13*|14*|15*|16*)
                if test -d ${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9
                then
                    echo "NDKr$IJK_NDK_REL detected"
                else
                    echo "You need the NDKr10e or later"
                    exit 1
                fi
            ;;
            *)
                echo "You need the NDKr10e or later"
                exit 1
            ;;
        esac

编译的最终情况是在执行do-compile-ffmpeg.sh脚本的时候,到了compile ffmpeg这一步没有问题,但是在下一步link ffpmeg的时候确出错了,错误提示如下:

libavcodec/v4l2_buffers.c:424: error: undefined reference to 'mmap64'
libavformat/hls.c:794: error: undefined reference to 'atof'
libavformat/hlsproto.c:149: error: undefined reference to 'atof'
libavutil/file.c:85: error: undefined reference to 'mmap64'
libavutil/log.c:188: error: undefined reference to 'stderr'
libavutil/log.c:362: error: undefined reference to 'stderr'
libavutil/log.c:362: error: undefined reference to 'stderr'
collect2: error: ld returned 1 exit status

这几个方法找不到,该怎么处理,这些函数都是放在哪里的?我不想将NDK的版本降级处理,该如何解决。
我是在MAC下编译的。

All 9 comments

这几个是libc函数吧,有什么link 参数没有加?

在NDK14上编译是没有问题的,在NDK16上就不行。

用 NDK14

这个是NDK从14到16的主要变化带来的通用问题,还没看到有什么解决办法。
Mark关注一下。

我用NDK13都编译不过,提示无法创建一个名字带chain的目录,改成readme里面说的ndk10就编译过了

遇到同样问题 NDK17:

[*] link ffmpeg

-Wl,--fix-cortex-a8
link compat/.o
link libavcodec/
.o
link libavcodec/arm/.o
link libavfilter/
.o
link libavformat/.o
link libavutil/
.o
link libavutil/arm/.o
link libswresample/
.o
link libswresample/arm/.o
link libswscale/
.o
link libswscale/arm/*.o
libavcodec/v4l2_buffers.c:424: error: undefined reference to 'mmap64'
libavformat/hls.c:794: error: undefined reference to 'atof'
libavformat/hlsproto.c:149: error: undefined reference to 'atof'
libavutil/file.c:85: error: undefined reference to 'mmap64'
libavutil/log.c:188: error: undefined reference to 'stderr'
libavutil/log.c:362: error: undefined reference to 'stderr'
libavutil/log.c:362: error: undefined reference to 'stderr'
/Users/hxm/opensource/ijkplayer-android/android/contrib/build/ffmpeg-armv7a/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: conditional branch to PLT in THUMB-2 not supported yet.
libswresample/arm/audio_convert_neon.S:137: error: unexpected opcode while processing relocation R_ARM_THM_JUMP19
collect2: error: ld returned 1 exit status

目前这个库还不支持使用NDK16版本进行构建,哪怕你改了脚本也不行。

我自己写了个构建脚本,已经解决了这个问题,欢迎使用。

https://github.com/biezhihua/FFmpegBuildTool

下载了FFmpegBuildTool,运行./android.sh --lib-ffmpeg --ffmpeg-config-min --arch-armeabi-v7a 命令,出现了错误,提示无效的参数--lib-ffmpeg,查看了android/main.sh文件,确实没有对该参数的处理,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liwuking picture liwuking  ·  4Comments

launam picture launam  ·  3Comments

yuyashuai picture yuyashuai  ·  3Comments

binaryxiaobao picture binaryxiaobao  ·  4Comments

xuluming picture xuluming  ·  4Comments