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

RTLD_* macros are not defined on Android #71119

Closed
xdegaye mannequin opened this issue May 3, 2016 · 13 comments
Closed

RTLD_* macros are not defined on Android #71119

xdegaye mannequin opened this issue May 3, 2016 · 13 comments
Assignees
Labels
build The build process and cross-build stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented May 3, 2016

BPO 26932
Nosy @amauryfa, @abalkin, @pitrou, @vstinner, @larryhastings, @meadori, @xdegaye, @serhiy-storchaka, @moreati, @yan12125
Files
  • posixmodule_rtld_constants.patch
  • rtld_constants.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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-05-04.06:47:18.358>
    created_at = <Date 2016-05-03.14:44:04.735>
    labels = ['type-bug', 'library', 'build']
    title = 'RTLD_* macros are not defined on Android'
    updated_at = <Date 2016-05-04.08:22:38.700>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2016-05-04.08:22:38.700>
    actor = 'xdegaye'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-05-04.06:47:18.358>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)', 'Cross-Build']
    creation = <Date 2016-05-03.14:44:04.735>
    creator = 'xdegaye'
    dependencies = []
    files = ['42703', '42705']
    hgrepos = []
    issue_num = 26932
    keywords = ['patch']
    message_count = 13.0
    messages = ['264733', '264772', '264774', '264776', '264777', '264778', '264780', '264781', '264782', '264783', '264788', '264792', '264794']
    nosy_count = 11.0
    nosy_names = ['amaury.forgeotdarc', 'belopolsky', 'pitrou', 'vstinner', 'larry', 'meador.inge', 'xdegaye', 'python-dev', 'serhiy.storchaka', 'Alex.Willmer', 'yan12125']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue26932'
    versions = ['Python 3.6']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 3, 2016

    test_posix fails on an android emulator running an x86 system image at API level 21.

    For the first ERROR, on android we have instead of a list of group IDs:
    root@generic_x86:/data/local/tmp # id -G
    uid=0(root) gid=0(root) groups=1003(graphics),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:su:s0

    ======================================================================
    ERROR: test_getgroups (test.test_posix.PosixTester)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_posix.py", line 815, in test_getgroups
        set([int(x) for x in groups.split()]),
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_posix.py", line 815, in <listcomp>
        set([int(x) for x in groups.split()]),
    ValueError: invalid literal for int() with base 10: 'uid=0(root)'

    ======================================================================
    ERROR: test_rtld_constants (test.test_posix.PosixTester)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_posix.py", line 1128, in test_rtld_constants
        posix.RTLD_LAZY
    AttributeError: module 'posix' has no attribute 'RTLD_LAZY'

    Ran 83 tests in 0.114s

    FAILED (errors=2, skipped=11)
    test test_posix failed
    1 test failed:
    test_posix
    Total duration: 0:00:01

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir build The build process and cross-build type-bug An unexpected behavior, bug, or error labels May 3, 2016
    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented May 3, 2016

    What RTLD_* constants exist on Android?

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented May 4, 2016

    On Android RTLD_* constants are not defined via macros but as enum values. I guess CPython needs to check each one in configure.ac. See [1]

    [1] https://android.googlesource.com/platform/bionic/+/master/libc/include/dlfcn.h

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented May 4, 2016

    Patch attached for improved RTLD_* checking.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented May 4, 2016

    For test_getgroups, in Android 5.1 id does not support -G. [1] In Android 6.x id seems to support -G. [2] I guess CPython can just skip the test on Android < 6.0.

    [1] https://android.googlesource.com/platform/system/core/+/android-5.1.1_r37/toolbox/id.c
    [2] https://android.googlesource.com/platform/external/toybox/+/master/toys/posix/id.c

    @serhiy-storchaka serhiy-storchaka self-assigned this May 4, 2016
    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented May 4, 2016

    LGTM. But needed to update pyconfig.h.in and configure.

    RTLD_* constants are also used in Modules/_ctypes/_ctypes.c and Python/pystate.c (this can be a cause of threading and ctypes issues on Android).

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented May 4, 2016

    Version 2.

    @serhiy-storchaka serhiy-storchaka changed the title android: test_posix fails RTLD_* macros are not defined on Android May 4, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 4, 2016

    New changeset 811ccdee6f87 by Serhiy Storchaka in branch 'default':
    Issue bpo-26932: Fixed support of RTLD_* constants defined as enum values,
    https://hg.python.org/cpython/rev/811ccdee6f87

    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented May 4, 2016

    Thank you Chi Hsuan Yen.

    Please open separate issue for "id -G".

    @serhiy-storchaka
    Copy link
    Member

    serhiy-storchaka commented May 4, 2016

    Xavier, please check that issues with ctypes and threading are not gone.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 4, 2016

    test_rtld_constants is now ok at the tip of the default branch.
    Thanks Chi Hsuan Yen.
    I will enter a separate issue for test_getgroups and reference it here as well as in issue bpo-26865.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 4, 2016

    I will enter a separate issue for test_getgroups and reference it here as well as in issue bpo-26865.
    issue bpo-26944: android: test_posix fails.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 4, 2016

    Xavier, please check that issues with ctypes and threading are not gone.

    No ctypes still crashes and threading still hangs.

    @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
    build The build process and cross-build stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant