This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xdegaye
Recipients xdegaye
Date 2016-10-26.09:38:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477474733.85.0.0781476042155.issue28538@psf.upfronthosting.co.za>
In-reply-to
Content
On the latest Android API level (android-24), the if_nameindex function is now found by configure in Android libc.  But the if_nameindex function and structure are still not defined in the Android net/if.h header.

The compilation fails with:

clang --sysroot=/opt/android-ndk/platforms/android-24/arch-x86 -target i686-none-linux-androideabi -gcc-toolchain /opt/android-ndk/toolchains/x86-4.9/prebuilt/linux-x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wno-unused-value -Wno-empty-body -Qunused-arguments -Wno-parentheses-equality -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -IObjects -IInclude -IPython -I/home/xavier/src/android/pyona/build/python3.7-install-android-24-x86/org.bitbucket.pyona/include -I/opt/android-ndk/platforms/android-24/arch-x86/usr/include -I/path/to/android/cpython/Include -I/home/xavier/src/android/pyona/build/python3.7-android-24-x86 -c /path/to/android/cpython/Modules/socketmodule.c -o build/temp.linux-i686-3.7/path/to/android/cpython/Modules/socketmodule.o
/path/to/android/cpython/Modules/socketmodule.c:1034:29: warning: comparison of integers of different signs: 'socklen_t' (aka 'int') and 'size_t' (aka 'unsigned int') [-Wsign-compare]
        if (res->ai_addrlen < addr_ret_size)
            ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
/path/to/android/cpython/Modules/socketmodule.c:1125:25: warning: comparison of integers of different signs: 'socklen_t' (aka 'int') and 'size_t' (aka 'unsigned int') [-Wsign-compare]
    if (res->ai_addrlen < addr_ret_size)
        ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
/path/to/android/cpython/Modules/socketmodule.c:4925:15: warning: implicit declaration of function 'sethostname' is invalid in C99 [-Wimplicit-function-declaration]
        res = sethostname(buf.buf, buf.len);
              ^
/path/to/android/cpython/Modules/socketmodule.c:6242:10: warning: implicit declaration of function 'if_nameindex' is invalid in C99 [-Wimplicit-function-declaration]
    ni = if_nameindex();
         ^
/path/to/android/cpython/Modules/socketmodule.c:6242:8: warning: incompatible integer to pointer conversion assigning to 'struct if_nameindex *' from 'int' [-Wint-conversion]
    ni = if_nameindex();
       ^ ~~~~~~~~~~~~~~
/path/to/android/cpython/Modules/socketmodule.c:6250:9: warning: implicit declaration of function 'if_freenameindex' is invalid in C99 [-Wimplicit-function-declaration]
        if_freenameindex(ni);
        ^
/path/to/android/cpython/Modules/socketmodule.c:6254:19: error: subscript of pointer to incomplete type 'struct if_nameindex'
    for (i = 0; ni[i].if_index != 0 && i < INT_MAX; i++) {
                ~~^
/path/to/android/cpython/Modules/socketmodule.c:6240:12: note: forward declaration of 'struct if_nameindex'
    struct if_nameindex *ni;
           ^
/path/to/android/cpython/Modules/socketmodule.c:6256:19: error: subscript of pointer to incomplete type 'struct if_nameindex'
                ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                ~~^
/path/to/android/cpython/Modules/socketmodule.c:6240:12: note: forward declaration of 'struct if_nameindex'
    struct if_nameindex *ni;
           ^
/path/to/android/cpython/Modules/socketmodule.c:6256:62: error: subscript of pointer to incomplete type 'struct if_nameindex'
                ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
                                                           ~~^
/path/to/android/cpython/Modules/socketmodule.c:6240:12: note: forward declaration of 'struct if_nameindex'
    struct if_nameindex *ni;
           ^
6 warnings and 3 errors generated.
History
Date User Action Args
2016-10-26 09:38:53xdegayesetrecipients: + xdegaye
2016-10-26 09:38:53xdegayesetmessageid: <1477474733.85.0.0781476042155.issue28538@psf.upfronthosting.co.za>
2016-10-26 09:38:53xdegayelinkissue28538 messages
2016-10-26 09:38:52xdegayecreate