Skip to content

FindThreads does not work with Android because it looks for pthread_cancel

In principle, FindThreads would be a very convenient cross-platform abstraction for pulling in the threading library in CMake. However, in practice it doesn't work out for us because it doesn't work reliably enough.

In the Android NDK, there is no separate library to link for pthreads. However, FindThreads is unable to detect it. Looking in the logs, the issue is that Android does not have pthread_cancel and CMake looks for it: https://github.com/Kitware/CMake/blob/24f1e7c524382e22e4c15499faa9c35ce607379b/Modules/FindThreads.cmake#L78

While it'd be nice if Android implemented pthreads more completely, thread cancelation is a fairly niche operation and most projects can make use of threading APIs quite effectively without it. I also doubt there are any platforms where pthread_create works directly but pthread_cancel requires a separate library. So I don't think testing that is necessary and it's sufficient to just test a few basic functions.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information