Android as of NDK r20 does not have support for gcc except through Clang.
However, modern versions of Clang on android inside the NDK no longer provide dynamic linking capability for openmp.
When a project is build on android with -fopenmp, it builds, but it fails at runtime with “dlopen cannot open libomp.so” https://github.com/Tencent/ncnn/issues/1771 because dynamic libomp is no longer supported.
The required fix for this on android is to add -static-omp on Android versions of clang that support that flag, or to add "
-Wl,-Bstatic -lomp -Wl,-Bdynamic" on versions of clang that do not.
This should be handled internally by FindOpenMP.cmake on platforms where it is relevant: e.g., if -static-omp is required by the local clang platform (initially, Android) and libomp.so is not enabled on the target platform, then OpenMP::OpenMP public link settings should include the correct flag to enable static linking without further intervention by the user.
This issue recently cost me about 8 hours to resolve and debug.
I will write a patch to do this but I wanted to get commentary on it before I took the time.