导读

根据ncnn的官方教程使用vulkan-sdk编译了一个带gpu功能的libncnn.a库,官方教程如下:

https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-windows-x64-using-visual-studio-community-2017

详细错误

../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(modelbin.cpp.o):modelbin.cpp:function ncnn::ModelBinFromDataReader::load(int, int) const: error: undefined reference to 'stderr'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(modelbin.cpp.o):modelbin.cpp:function ncnn::ModelBinFromDataReader::load(int, int) const: error: undefined reference to 'stderr'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(modelbin.cpp.o):modelbin.cpp:function ncnn::ModelBinFromDataReader::load(int, int) const: error: undefined reference to 'stderr'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(modelbin.cpp.o):modelbin.cpp:function ncnn::ModelBinFromDataReader::load(int, int) const: error: undefined reference to 'stderr'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkAllocator::flush(ncnn::VkBufferMemory*): error: undefined reference to 'vkFlushMappedMemoryRanges'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkAllocator::invalidate(ncnn::VkBufferMemory*): error: undefined reference to 'vkInvalidateMappedMemoryRanges'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkAllocator::create_buffer(unsigned int, unsigned int): error: undefined reference to 'vkCreateBuffer'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkAllocator::allocate_memory(unsigned int): error: undefined reference to 'vkAllocateMemory'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkAllocator::allocate_dedicated_memory(unsigned int, unsigned long long): error: undefined reference to 'vkAllocateMemory'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkBlobBufferAllocator::clear(): error: undefined reference to 'vkDestroyBuffer'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkBlobBufferAllocator::clear(): error: undefined reference to 'vkFreeMemory'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkBlobBufferAllocator::clear(): error: undefined reference to 'vkUnmapMemory'
../../../../src/main/cppLibs/ncnn/lib/armeabi-v7a/libncnn.a(allocator.cpp.o):allocator.cpp:function ncnn::VkBlobBufferAllocator::fastMalloc(unsigned int): error: undefined reference to 'vkCreateBuffer'

解决办法

我在编译Android工程的时候,采用的是build.gradle和CMakeLists.txt文件来进行配置的,如果你是使用的Android.mk和application.mk文件可能配置上会有些区别

  • build.gradle文件中添加以下内容

想要使用GPU功能,Android的版本必须在24(Android7.0)以上

android {defaultConfig {minSdkVersion 24//应用支持Android的最低版本externalNativeBuild {cmake {arguments "-DANDROID_PLATFORM=android-24"//设置编译so文件的时候Android的版本}}}
}
  • CMakeLists.txt文件中添加如下内容
target_link_libraries( # Specifies the target library.jnigraphicsvulkan)
  • Android.mk文件添加如下内容
LOCAL_LDLIBS := -lz -llog -ljnigraphics -lvulkan -landroid

application.mk中添加

APP_PLATFORM := android-24

ncnn使用GPU时报error: undefined reference to *******相关推荐

  1. 【ffmpeg】编译时报错:error: undefined reference to `av...

    1.问题描述 昨天使用ffmpeg库编译demo一切正常,今天再次链接ffmpeg库时报了一堆错误: error: undefined reference to `av_frame_alloc()' ...

  2. 【Qt】error: undefined reference to `vtable for MainWindow‘

    1.问题描述 在写一个demo时,想尽量简单,就把MainWindow类的定义和实现都写在main.cpp中,结果编译时报错: main.cpp:-1: error: undefined refere ...

  3. error: undefined reference to `calculate()`报错

    在调用xx.h和xx.c中的函数,比如calculate()时 如下: #include "xx.h" int t; int result = calculate(t); 此时报错 ...

  4. 【Qt】报错error: undefined reference to `vtable for的解决方法

    1.问题描述 编译Qt程序时,在某个类构造函数定义处报错: error: undefined reference to `vtable for 2.原因分析 导致错误信息的原因是:子类没有实现父类的纯 ...

  5. error undefined reference to __android_log_print

    error undefined reference to '__android_log_print 配置 Android.mk文件 输入 LOCAL_LDLIBS := -llog 打印日志库 注意: ...

  6. 【错误记录】Android NDK 错误排查记录 ( error: undefined reference to | Linking CXX shared library FAILED )

    文章目录 一. 报错信息 二. 错误分析 三. 错误总结 一. 报错信息 报错信息 : Build command failed. Error while executing process Y:\0 ...

  7. Android系统编译so库提示error undefined reference to '__android_log_print问题的解决

    在系统源代码的hardware/qcom下增加psam文件夹,编译源代码要生成libpsam.so库,Android.mk内容 LOCAL_PATH := $(call my-dir) include ...

  8. pthread_create函数编译时报错:undefined reference to 'pthread_create'

    错误: pthread_create函数编译时报错:undefined reference to 'pthread_create' pthread_create()和pthread_atfork()函 ...

  9. android error: undefined reference to 的错误分析

    今天,简单讲讲android  error: undefined reference to 的错误分析. 昨天,做jni,连接so库时,android studio出现了这个问题.当时不知道是什么 ...

  10. 解决Error: undefined reference to `__android_log_print'

    解决Error: undefined reference to `__android_log_print'     最近在使用Android Studio进行NDK开发时,程序本身是没有问题,但一旦添 ...

最新文章

  1. js点击获取连接的内容
  2. MFC 学习的基本概念
  3. mysql 数据表创建字段类型_MySQL 数据类型简介 创建数据表及其字段约束
  4. 96. 不同的二叉搜索树
  5. LeetCode 1586. 二叉搜索树迭代器 II(数组+栈)
  6. spring aop实现日志收集
  7. 在线教育app平台搭建招生系统教培系统源码
  8. 初识powerpoint的计算机教案,《初识PowerPoint》教案
  9. 专业的压缩解压缩工具 WinZip Pro 7 for Mac
  10. 【提高组NOIP2007】矩阵取数游戏
  11. 修改数据库长度mysql_mysql 修改数据库长度
  12. 服务器对接qq微信聊天,java仿QQ微信聊天室功能的实现
  13. 4412开发板项目实战-云服务器智能家居
  14. 欧几里德算法(Euclidean algorithm)
  15. EDK2编译环境搭建、编译、在模拟器运行、在笔记本运行
  16. python添加文字水印中间旋转45度,Python添加pdf水印
  17. djyvp2计算机电缆哪家好,ZA-DJYVP22-2*2*1.5计算机电缆
  18. 用Python爬取wallhaven高清原图
  19. [每天读一点英文]Obama就职典礼演说gnuhpc标注版
  20. [UE5蓝图基础二]11.[蒙太奇动画调用] 释放火球--实现火球抛射二

热门文章

  1. MATLAB实现imrotate函数
  2. mean shift segmentation matlab,Mean Shift图像分割算法的并行化
  3. 您的计算机性能不足 无法运行,绝地求生进不去游戏提示运行引擎需要DX11特性等级10.0,大神救我,刚做的系统W10 64位的,游戏也是刚下的...
  4. 支付宝小程序链接跳转异常处理方法
  5. C语言学习(一)软件篇
  6. 笔记本电脑电源和电池充电管理电路设计
  7. 第五人格显示服务器维护中请稍后登录怎么办,第五人格维护登不上怎么办 服务器维护中详情...
  8. 计算机系统时microsoft账号是,电脑microsoft账户登不进去
  9. EnergyPlus笔记
  10. WinZip for Mac注册版