Search code examples
android-ndkcross-compilingcpythontoolchain

Cross-compile of CPython 3.8 fails at _socket module


I am trying to cross-compile CPython 3.8 using Android NDK toolchains with enabled _socket module but unfortunately compilation failes at:

../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);
                                                              ^

Whithout _socket module the whole cross-compilation works well, there are no errors.


Solution

  • Problem solved using the latest r23b version of Android NDK.