Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openmp冲突引起crash #5432

Open
ljdang opened this issue Apr 17, 2024 · 0 comments
Open

openmp冲突引起crash #5432

ljdang opened this issue Apr 17, 2024 · 0 comments

Comments

@ljdang
Copy link

ljdang commented Apr 17, 2024

两个动态库test1.so和test2.so,其中test1.so链接了ncnn动态库,test2.so链接了opencv-mobile静态库,单独使用时,功能都是正常。在同一个app中引用,加载的时候会出现openmp冲突问题。

error log | 日志或报错信息 | ログ

backtrace:
#00 pc 000000000005b710 /apex/com.android.runtime/lib64/bionic/libc.so (abort+168) (BuildId: cdb09e5d494726046776ac6d0238c81f)
#1 pc 0000000000922fc8 /system/lib64/libncnn.so (__kmp_abort_process+52) (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#2 pc 0000000000921348 /system/lib64/libncnn.so (__kmp_fatal+128) (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#3 pc 000000000092a544 /system/lib64/libncnn.so (__kmp_register_library_startup()+572) (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#4 pc 0000000000921ea0 /system/lib64/libncnn.so (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#5 pc 000000000092a63c /system/lib64/libncnn.so (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#6 pc 000000000092a5f8 /system/lib64/libncnn.so (__kmp_middle_initialize+72) (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)
#7 pc 0000000000984cc0 /system/lib64/libncnn.so (omp_get_max_threads+36) (BuildId: f51a5f7850bbcdb568d4f5e4057d39c9192c83bc)

context | 编译/运行环境 | バックグラウンド

Android NDK21
ncnn-20230223-android-vulkan-shared
opencv-mobile-4.8.1-android

替换成opencv-mobile-4.6.0-android版本不包含openmp,但是编译的时候需要自己链接openmp,不然编译不过
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -static-openmp")

替换成原生opencv,test2.so链接opencv动态库,这时候,一起加载是正常的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant