Ncnn: android studio 工程使用ncnn 静态库,编译出现问题

Created on 16 Feb 2020  ·  3Comments  ·  Source: Tencent/ncnn

使用android studio 添加 ncnn lib 时,出现
error: undefined reference to '__kmpc_for_static_init_8'
在cmakelist 编译中添加了:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
编译出来得app 会闪退,怎么解决

Most helpful comment

https://stackoverflow.com/questions/59794824/android-app-crash-after-ndk-upgraded-from-20-1-to-21-0
你看看这个能不能帮到你,我今天也遇到这个问题!
我在Android.mk中修改了这两行,就正常啦。

LOCAL_CFLAGS += -fopenmp -static-openmp
LOCAL_CPPFLAGS += -fopenmp -static-openmp
LOCAL_LDFLAGS += -fopenmp -static-openmp

All 3 comments

https://github.com/nihui/ncnn-android-squeezenet
这是个模板工程,可以试试看能不能用,参考下

https://stackoverflow.com/questions/59794824/android-app-crash-after-ndk-upgraded-from-20-1-to-21-0
你看看这个能不能帮到你,我今天也遇到这个问题!
我在Android.mk中修改了这两行,就正常啦。

LOCAL_CFLAGS += -fopenmp -static-openmp
LOCAL_CPPFLAGS += -fopenmp -static-openmp
LOCAL_LDFLAGS += -fopenmp -static-openmp

感谢大佬!!困扰了我一星期终于找到答案了。。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xhappy picture xhappy  ·  5Comments

mychina75 picture mychina75  ·  4Comments

ghost picture ghost  ·  3Comments

xuqiong1989 picture xuqiong1989  ·  5Comments

nihui picture nihui  ·  5Comments