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

运行报错dlopen failed: library "libomp.so" not found #1771

Closed
Jobernowl opened this issue May 18, 2020 · 3 comments
Closed

运行报错dlopen failed: library "libomp.so" not found #1771

Jobernowl opened this issue May 18, 2020 · 3 comments

Comments

@Jobernowl
Copy link

Jobernowl commented May 18, 2020

以下是我的编译环境信息
android studio 3.6.3
ndk 21.1.6352462
com.android.tools.build:gradle:3.6.3

CMakeLists.txt
`
cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fopenmp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffast-math")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffast-math")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")

include_directories(include)

file(GLOB _SRC *.h
*.cpp)

add_library(libncnn STATIC IMPORTED )
set_target_properties(libncnn
PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libncnn.a)

#编译为动态库
add_library(ncnn-jni SHARED ${_SRC})

target_link_libraries(ncnn-jni
libncnn
android
jnigraphics
omp
log)
`
cmake version 3.10.2
minSdkVersion 16
targetSdkVersion 29
模拟器是x86_64 Android 10.0(Q)

@nihui
Copy link
Member

nihui commented May 18, 2020

#976 (comment)

参考这里的

@Jobernowl
Copy link
Author

Jobernowl commented May 18, 2020

#976 (comment)

参考这里的

感谢回答,根据上面链接的说明解决错误

@xiashaohua2010
Copy link

refer to android/ndk#1028,
use the target_link_libraries (styletransferncnn -static-openmp -fopenmp) in the CMakeLists.txt

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

3 participants