Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_socket module cross-compilation error on android-24 #72724

Closed
xdegaye mannequin opened this issue Oct 26, 2016 · 7 comments
Closed

_socket module cross-compilation error on android-24 #72724

xdegaye mannequin opened this issue Oct 26, 2016 · 7 comments
Labels
3.7 build The build process and cross-build

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Oct 26, 2016

BPO 28538
Nosy @doko42, @xdegaye, @moreati
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • bpo-28538: Revert all the changes (now using Android Unified Headers) #4479
  • Files
  • if_nameindex.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-11-23.10:15:27.188>
    created_at = <Date 2016-10-26.09:38:53.823>
    labels = ['build', '3.7']
    title = '_socket module cross-compilation error on android-24'
    updated_at = <Date 2017-11-23.10:15:27.187>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-23.10:15:27.187>
    actor = 'xdegaye'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-23.10:15:27.188>
    closer = 'xdegaye'
    components = ['Cross-Build']
    creation = <Date 2016-10-26.09:38:53.823>
    creator = 'xdegaye'
    dependencies = []
    files = ['45394']
    hgrepos = []
    issue_num = 28538
    keywords = ['patch']
    message_count = 7.0
    messages = ['279495', '280340', '283745', '283765', '283768', '306579', '306797']
    nosy_count = 4.0
    nosy_names = ['doko', 'xdegaye', 'python-dev', 'Alex.Willmer']
    pr_nums = ['552', '4479']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue28538'
    versions = ['Python 3.6', 'Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Oct 26, 2016

    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.

    @xdegaye xdegaye mannequin added 3.7 build The build process and cross-build labels Oct 26, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 8, 2016

    Patch attached.

    @xdegaye xdegaye mannequin added the build The build process and cross-build label Nov 8, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 21, 2016

    New changeset e248bfb0f520 by Xavier de Gaye in branch '3.6':
    Issue bpo-28538: Fix the compilation error that occurs because if_nameindex() is
    https://hg.python.org/cpython/rev/e248bfb0f520

    New changeset 55bf0b79ec55 by Xavier de Gaye in branch 'default':
    Issue bpo-28538: Merge 3.6.
    https://hg.python.org/cpython/rev/55bf0b79ec55

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Dec 21, 2016

    These changes break the darwin platform, socket.if_nameindex() is not defined anymore. On Darwin, 'net/if.h' requires that 'sys/socket.h' be included beforehand (see the autoconf documentation).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 21, 2016

    New changeset f34dac552ad8 by Xavier de Gaye in branch '3.6':
    Issue bpo-28538: On Darwin net/if.h requires that sys/socket.h be included beforehand.
    https://hg.python.org/cpython/rev/f34dac552ad8

    New changeset c568b6ac5e89 by Xavier de Gaye in branch 'default':
    Issue bpo-28538: Merge 3.6.
    https://hg.python.org/cpython/rev/c568b6ac5e89

    @xdegaye xdegaye mannequin closed this as completed Dec 21, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 20, 2017

    These changes are not needed anymore now that Unified Headers are supported by android-ndk-r14 (see bpo-29040)

    @xdegaye xdegaye mannequin reopened this Nov 20, 2017
    @xdegaye xdegaye mannequin added the invalid label Nov 20, 2017
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Nov 23, 2017

    New changeset 5ad7ef8 by xdegaye in branch 'master':
    bpo-28538: Revert all the changes (now using Android Unified Headers) (GH-4479)
    5ad7ef8

    @xdegaye xdegaye mannequin closed this as completed Nov 23, 2017
    @xdegaye xdegaye mannequin removed the invalid label Nov 23, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants