-
Notifications
You must be signed in to change notification settings - Fork 296
Description
Description
getloadavg exists in libc.so of API 29:
$ nm /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/29/libc.so | grep getloadavg
0000eacf T getloadavg
But not in stdlib.h:
$ rg -A 1 -B 1 'int getloadavg' /opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
/opt/android-ndk-beta/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdlib.h
206-#if __ANDROID_API__ >= __ANDROID_API_FUTURE__
207:int getloadavg(double __averages[], int __n) __INTRODUCED_IN_FUTURE;
208-#endif /* __ANDROID_API__ >= __ANDROID_API_FUTURE__ */
Such a difference prevents building CPython. CPython uses the m4 macro AC_CHECK_FUNCS to determine whether getloadavg is available or not [1]. This m4 macro only checks whether a symbol exists or not, but not whether a function is declared or not. The result is compilation failure:
./Modules/posixmodule.c:11390:9: error: implicit declaration of function 'getloadavg' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (getloadavg(loadavg, 3)!=3) {
^
A full log can be found in [2].
/cc @enh - the author of the relevant Gerrit revision [3].
[1] https://github.com/python/cpython/blob/f2f55e7f03d332fd43bc665a86d585a79c3b3ed4/configure.ac#L3519
[2] https://ci.chyen.cc/api/v2/logs/2759/raw
[3] https://android-review.googlesource.com/c/platform/bionic/+/799647
Environment Details
- NDK Version: NDK r20 beta 1
- Build system: custom
- Host OS: Arch Linux
- Compiler: Clang
- ABI: ARM
- STL: N/A
- NDK API level: 29
- Device API level: N/A - build issue