Details
Description
The volumeraycaster demo can fail to start on Android because of a missing runtime dependency to libomp.so. The CMakeLists.txt file for the example does a check for "OpenMP" and apparently finds it in the NDK, but when the application is packaged in an APK and deployed to an Android device, at runtime there is no libomp.so to dlopen.
E AndroidRuntime: FATAL EXCEPTION: qtMainLoopThread E AndroidRuntime: Process: org.qtproject.example.volumeraycaster, PID: 32138 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libomp.so" not found: needed by /data/app/~~mtHfNZFs7lIH87_sEyRELw==/org.qtproject.example.volumeraycaster-J-uKPU8NgPKu5w2QpjgPQg==/base.apk!/lib/arm64-v8a/libvolumeraycaster_arm64-v8a.so in namespace classloader-namespace E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1077) E AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:998) E AndroidRuntime: at java.lang.System.loadLibrary(System.java:1656) E AndroidRuntime: at org.qtproject.qt.android.QtLoader.loadLibraryHelper(QtLoader.java:474) E AndroidRuntime: at org.qtproject.qt.android.QtLoader.lambda$loadMainLibrary$0$org-qtproject-qt-android-QtLoader(QtLoader.java:523) E AndroidRuntime: at org.qtproject.qt.android.QtLoader$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0) E AndroidRuntime: at org.qtproject.qt.android.QtThread.lambda$run$0(QtThread.java:57) E AndroidRuntime: at org.qtproject.qt.android.QtThread$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0) E AndroidRuntime: at org.qtproject.qt.android.QtThread$1.run(QtThread.java:25) E AndroidRuntime: at java.lang.Thread.run(Thread.java:920) I Process : Sending signal. PID: 32138 SIG: 9
Disabling the OpenMP lines allows the example to run:
# if(OpenMP_CXX_FOUND)
# target_link_libraries(volumeraycaster PUBLIC
# OpenMP::OpenMP_CXX
# )
# endif()
So this build system logic is not 100% air tight, and likely needs something extra here to catch this case on Android.