首页 > 解决方案 > CPython 3.8 的交叉编译在 _socket 模块处失败

问题描述

我正在尝试使用启用了 _socket模块的 Android NDK 工具链交叉编译 CPython 3.8,但不幸的是编译失败:

../Modules/socketmodule.c:6739:5: error: invalid use of undefined type 'struct if_nameindex'
     for (i = 0; ni[i].if_index != 0 && i < INT_MAX; i++) {
     ^
../Modules/socketmodule.c:6739:19: error: dereferencing pointer to incomplete type
     for (i = 0; ni[i].if_index != 0 && i < INT_MAX; i++) {
                   ^
../Modules/socketmodule.c:6753:17: error: invalid use of undefined type 'struct if_nameindex'
                 ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                 ^
../Modules/socketmodule.c:6753:19: error: dereferencing pointer to incomplete type
                 ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                   ^
../Modules/socketmodule.c:6753:17: error: invalid use of undefined type 'struct if_nameindex'
                 ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                 ^
../Modules/socketmodule.c:6753:62: error: dereferencing pointer to incomplete type
                 ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                                                              ^

没有 _socket 模块,整个交叉编译运行良好,没有错误。

标签: android-ndkcross-compilingcpythontoolchain

解决方案


使用最新的 r23b 版本的 Android NDK 解决了问题。


推荐阅读