java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt6__ndk15mutexD1Ev"
Options
The app crashes with java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt6__ndk15mutexD1Ev" referenced by ... in Android Studio with NDK r14b
I have added -D_EG_ANDROID_PLATFORM -DEG_DEBUGGER -D__STDINT_LIMITS -DHAVE_PTHREADS to CMAKE_CXX_FLAGS
Related part of the CMakeLists.txt:
add_library(lib_PHOTON STATIC IMPORTED)
set_target_properties(lib_PHOTON PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libphoton.a)
add_library(lib_COMMON STATIC IMPORTED)
set_target_properties(lib_COMMON PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libcommon.a)
add_library(lib_LOADBALANCING STATIC IMPORTED)
set_target_properties(lib_LOADBALANCING PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libloadbalancing.a)
# add lib dependencies
target_link_libraries(app
lib_LOADBALANCING
lib_PHOTON
lib_COMMON
android
atomic
log)
Thank you for any help you can offer.
I have added -D_EG_ANDROID_PLATFORM -DEG_DEBUGGER -D__STDINT_LIMITS -DHAVE_PTHREADS to CMAKE_CXX_FLAGS
Related part of the CMakeLists.txt:
add_library(lib_PHOTON STATIC IMPORTED)
set_target_properties(lib_PHOTON PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libphoton.a)
add_library(lib_COMMON STATIC IMPORTED)
set_target_properties(lib_COMMON PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libcommon.a)
add_library(lib_LOADBALANCING STATIC IMPORTED)
set_target_properties(lib_LOADBALANCING PROPERTIES IMPORTED_LOCATION
${PREBUILTSPHOTON_DIR}/lib/${ANDROID_ABI}/libloadbalancing.a)
# add lib dependencies
target_link_libraries(app
lib_LOADBALANCING
lib_PHOTON
lib_COMMON
android
atomic
log)
Thank you for any help you can offer.
0
Comments
-
Hi @OnurB.
Which flavors of the Photon libs do you link against? 'libcommon' is not a valid library name. Something like 'libcommon-cpp-static_debug_android_arm64-v8a.a' would be. The same is true for the Photon and the LoadBalancing lib.
Do you link your app against libstdc++ or against libc++? In the former case make sure that you link against the variants of the Photon libs that don't have a '_libc++' at the end of the filenames, in the latter case ensure that you link against those which do have '_libc++" at the end of their filenames. Also in the former case make sure that you add '-std=c++11' to your cpp flags. This should not be necessary in the latter case.1 -
Thanks for the reply. I linked against :
libloadbalancing-cpp-static_release_android_armeabi-v7a_libc++.a
libphoton-cpp-static_release_android_armeabi-v7a_libc++.a
libcommon-cpp-static_release_android_armeabi-v7a_libc++.a
It was std=c++14 . I switched to std=c++11
I tried linking against:
libloadbalancing-cpp-static_release_android_armeabi-v7a.a
libphoton-cpp-static_release_android_armeabi-v7a.a
libcommon-cpp-static_release_android_armeabi-v7a.a
It didnt work.
Should it be work with NDK 14 ? Because it says in the error ndk15mutex .
I converted VisualGDB project of Basic Demo to Android Studio project.I tried NDK 15 but it gave me "requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC" even I've added -fPIC option in gcc.And "exception specification of explicitly defaulted default constructor does not match the calculated one" in clang at <atomic>
Maybe I choosed wrong options in build.gradle . Is it possible to upload Android Studio project of Basic Demo? Thanks.0 -
Hi @OnurB.It was std=c++14 . I switched to std=c++11Should it be work with NDK 14 ?
This looks like a mismatch between the clang and gcc stdlib in your project setup.
Please see https://forum.photonengine.com/discussion/14357/integration-guide for further information.1 -
Thanks for your answers. Problem solved by linking against not ending with "...libc++.a" libraries.0