-
Notifications
You must be signed in to change notification settings - Fork 10
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
android ndk doesn't support these functions. #21
Comments
@fnwinter I think |
It's not exposed in the NDK 21.4 - is it exposed in a newer one? (should we be using dlsym or somehow finding the symbol at runtime?) Even Meta/Facebook is not using it: https://github.com/facebook/folly/blob/main/folly/system/ThreadName.cpp#L122 |
I can found related API exposed by
But #if __ANDROID_API__ >= 26
int pthread_getname_np(pthread_t __pthread, char* __buf, size_t __n) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */ If the minimum SDK is less than 26, maybe it will throw an Exception that API not found. I have encountered similar problem when using a NDK API added from higher SDK than project's minimum SDK. I hope |
@rpavlik What about trying changing minimum SDK to 26 at https://gitlab.freedesktop.org/monado/utilities/percetto-android-build/-/blob/main/percetto-lib/build.gradle.kts#L29 and using |
There is an example of envoy: https://github.com/envoyproxy/envoy/pull/12011/files. |
And the minimum NDK version that supports 21.0.6113669/sysroot/usr/include/stdatomic.h:73:using std::atomic_fetch_or;
21.0.6113669/sysroot/usr/include/stdatomic.h:74:using std::atomic_fetch_or_explicit;
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:221:#define atomic_fetch_or_explicit(object, operand, order) \
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:222: __c11_atomic_fetch_or(object, operand, order)
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:248:#define atomic_fetch_or(object, operand) \
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:249: atomic_fetch_or_explicit(object, operand, memory_order_seq_cst)
21.0.6113669/sysroot/usr/include/stdatomic.h:77:using std::atomic_fetch_and;
21.0.6113669/sysroot/usr/include/stdatomic.h:78:using std::atomic_fetch_and_explicit;
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:219:#define atomic_fetch_and_explicit(object, operand, order) \
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:220: __c11_atomic_fetch_and(object, operand, order)
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:246:#define atomic_fetch_and(object, operand) \
21.0.6113669/sysroot/usr/include/bits/stdatomic.h:247: atomic_fetch_and_explicit(object, operand, memory_order_seq_cst) |
Yep, updating the platform to 26 fixes the pthread issue, while #17 fixes the atomic issue. #26 builds on #17 by adding CMake files and scripts to build an AAR file with a single command. Unlike my earlier percetto-android-build repo, this AAR is marked as belonging to this repo ( |
@utzcoz thank you for finding the symbol. I will close this issue. |
there are no pthread_getname_np, std::atomic_fetch_or, std::atomic_fetch_and functions for android.
I am building with clang11 and ndk (21,23)
The text was updated successfully, but these errors were encountered: