android libuv 使用未声明的标识符 'EPOLL_CLOEXEC'

android libuv use of undeclared identifier 'EPOLL_CLOEXEC'

我正在尝试在 android studio cmake 中为 android 构建 libuv,但出现以下错误:

error: use of undeclared identifier 'EPOLL_CLOEXEC'

warning: implicit declaration of function 'epoll_pwait' [-Wimplicit-function-declaration]

warning: this function declaration is not a prototype [-Wstrict-prototypes]

我该如何解决这个问题? 我应该使用 libuv 工具链来构建它吗?

问题可能是您的 minSdkVersion 太低了。直到 Android L 才支持它。不幸的是,因为一些其他流行的项目滥用该常量来检测 epoll_create1 是否可用,所以该常量在 epoll_create1 可用之前不可用。有关详细信息,请参阅 https://github.com/android-ndk/ndk/issues/394