android - 使用 libvpx x86 android 构建项目失败并出现 undefined reference 错误

标签 android c++ c android-x86

我需要添加到 android 项目原子处理器支持。在 x86 下配置和构建 libvpx 库,参数为:

./configure --disable-examples --sdk-path = '/ Android / ndk' --enable-vp8 --target = x86-android-gcc --disable-postproc
make

构建成功,我得到一个静态库 libvpx.a 将库添加到项目:

include $ (CLEAR_VARS)
LOCAL_MODULE: = vpx
LOCAL_SRC_FILES: = thirdparty / webm / libvpx / $ (TARGET_ARCH_ABI) / libvpx.a
include $ (PREBUILT_STATIC_LIBRARY)

LOCAL_STATIC_LIBRARIES: = stdc++ jpeg png vorbis vorbisfile vorbisenc theora theoradec libwebp vpx

但在项目组装过程中出现错误:

jni/thirdparty/webm/libvpx/x86/libvpx.a (vp8_dx_iface.co) (. text +0 x568): error: undefined reference to '__vsnprintf_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (vp8_dx_iface.co) (. text +0 x596): error: undefined reference to '__longjmp_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (onyxd_if.co) (. text +0 x158): error: undefined reference to '__vsnprintf_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (onyxd_if.co) (. text +0 x186): error: undefined reference to '__longjmp_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (onyxd_if.co) (. text.unlikely +0 x23): error: undefined reference to '__assert_fail'
jni/thirdparty/webm/libvpx/x86/libvpx.a (yv12extend.co): function vp8_yv12_extend_frame_borders_c: error: undefined reference to '__assert_fail'
jni/thirdparty/webm/libvpx/x86/libvpx.a (yv12extend.co): function vp8_yv12_extend_frame_borders_c: error: undefined reference to '__assert_fail'
jni/thirdparty/webm/libvpx/x86/libvpx.a (yv12extend.co): function vp8_yv12_extend_frame_borders_c: error: undefined reference to '__assert_fail'
jni/thirdparty/webm/libvpx/x86/libvpx.a (decodframe.co) (. text +0 x198): error: undefined reference to '__vsnprintf_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (decodframe.co) (. text +0 x1c6): error: undefined reference to '__longjmp_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (boolhuff.co) (. text +0 x55): error: undefined reference to '__longjmp_chk'
jni/thirdparty/webm/libvpx/x86/libvpx.a (onyx_if.co) (. text +0 xa08): error: undefined reference to '__vsnprintf_chk'

有人知道怎么解决吗?在armeabi下构建项目成功。 尝试添加标志 APP_CPPFLAGS +=-std=gnu++11 并更改 ndk 的版本

NDK_TOOLCHAIN_VERSION: = 4.8

该项目的其他标志:

APP_STL: = gnustl_static
APP_CPPFLAGS + =-frtti-fexceptions
APP_CFLAGS + =-Wno-error = format-security
APP_ABI: = armeabi x86

用于构建ndk android-ndk-r9d-linux-x86(我尝试使用android-ndk-r9d-linux-x86_64 - 相同的结果),Ubuntu 13.10 x86_64,Eclipse 3.8.1

最佳答案

对我来说,添加 --extra-cflags="-U_FORTIFY_SOURCE" 覆盖了 __longjmk_chk__vsnprintf_chk

我写了空的__assert_fail函数:extern "C"{ void __assert_fail() {} }

关于android - 使用 libvpx x86 android 构建项目失败并出现 undefined reference 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23240789/

相关文章:

android - 自定义 TabLayout 指示器。制作标签指示器圆角?

c++ - DJI SDK 无法启动协同 Waypoint 任务

命令行参数。计算、乘法(*) 不起作用

c++ - 关于 C/C++ 标准中的时间/空间复杂度

c - 为什么循环裂变在这种情况下有意义?

android - 在 Eclipse 中使用 Android 5.0 版本的 CardView

android - fragment 隐藏动画不播放

在mac终端找不到android命令

c++ - 我的程序在 boost::thread::thread_start_function 中崩溃,我该如何调试

c++ - `ncurses` 函数 `wgetstr` 正在修改我的变量