PaddlePaddle / Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
https://www.paddlepaddle.org.cn/lite
Apache License 2.0
6.89k stars 1.6k forks source link

paddlie-lite推理静态库链接后推理报错 #10493

Open renshujiajia opened 2 months ago

renshujiajia commented 2 months ago

为使您的问题得到快速解决,在建立 Issue 前,请您先通过如下方式搜索是否有相似问题: 历史 issue, FAQ 文档, 官方文档

建立 issue 时,为快速解决问题,请您根据使用情况给出如下信息:

lishicheng1996 commented 2 months ago

已收到您的issue,等内部同学看一下

xiebaiyuan commented 2 months ago

没引用paddleop,spaddlekernels这几个头文件

hong19860320 commented 2 months ago

静态库一定要引用这三个头文件:

include "include/paddle_api.h"

include "include/paddle_use_kernels.h"

include "include/paddle_use_ops.h"

renshujiajia commented 2 months ago

静态库一定要引用这三个头文件: #include "include/paddle_api.h" #include "include/paddle_use_kernels.h" #include "include/paddle_use_ops.h"

添加后报错变成了:(.text._ZN6paddle4lite3arm4math25conv_depthwise_5x5s2_int8IfEEvPT_PKaS7_PKfS9_biPfiiiiiiiiPNS0_7ContextILNS_8lite_api10TargetTypeE4EEE[_ZN6paddle4lite3arm4math25conv_depthwise_5x5s2_int8IfEEvPT_PKaS7_PKfS9_biPfiiiiiiiiPNS0_7ContextILNS_8lite_api10TargetTypeE4EEE]+0x2d4): undefined reference to __kmpc_fork_call' ../../3rdparty/inference_lite_lib.android.armv8.clang.c++_static.with_extra/cxx/lib/libpaddle_api_light_bundled.a(conv5x5s2_depthwise_int8.cc.o): In function.omp_outlined..1': conv5x5s2_depthwise_int8.cc:(.text..omp_outlined..1+0xb0): undefined reference to __kmpc_for_static_init_4' conv5x5s2_depthwise_int8.cc:(.text..omp_outlined..1+0x170): undefined reference toomp_get_thread_num' conv5x5s2_depthwise_int8.cc:(.text..omp_outlined..1+0x6b4): undefined reference to `__kmpc_for_static_fini' clang++: error: linker command failed with exit code 1 (use -v to see invocation) 请问你有遇到过吗

hong19860320 commented 2 months ago

看起来没有找到 OMP的符号,你需要重新编译一个没有 OMP 的 LITE 库。 https://github.com/PaddlePaddle/Paddle-Lite/blob/ddd8fd8ad2c0b5c412cca99a04f1a48a36104187/CMakeLists.txt#L66 ON 改成 OFF