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.

classification
Title: RTLD_* macros are not defined on Android
Type: behavior Stage: resolved
Components: Cross-Build, Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Alex.Willmer, amaury.forgeotdarc, belopolsky, larry, meador.inge, pitrou, python-dev, serhiy.storchaka, vstinner, xdegaye, yan12125
Priority: normal Keywords: patch

Created on 2016-05-03 14:44 by xdegaye, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
posixmodule_rtld_constants.patch yan12125, 2016-05-04 03:31 review
rtld_constants.patch yan12125, 2016-05-04 06:06 review
Messages (13)
msg264733 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-05-03 14:44
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
msg264772 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-03 21:54
What RTLD_* constants exist on Android?
msg264774 - (view) Author: (yan12125) * Date: 2016-05-04 02:54
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
msg264776 - (view) Author: (yan12125) * Date: 2016-05-04 03:31
Patch attached for improved RTLD_* checking.
msg264777 - (view) Author: (yan12125) * Date: 2016-05-04 03:50
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
msg264778 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-04 04:49
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).
msg264780 - (view) Author: (yan12125) * Date: 2016-05-04 06:06
Version 2.
msg264781 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-04 06:45
New changeset 811ccdee6f87 by Serhiy Storchaka in branch 'default':
Issue #26932: Fixed support of RTLD_* constants defined as enum values,
https://hg.python.org/cpython/rev/811ccdee6f87
msg264782 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-04 06:47
Thank you Chi Hsuan Yen.

Please open separate issue for "id -G".
msg264783 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-04 06:58
Xavier, please check that issues with ctypes and threading are not gone.
msg264788 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-05-04 07:55
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 #26865.
msg264792 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-05-04 08:05
> I will enter a separate issue for test_getgroups and reference it here as well as in issue #26865.
issue #26944: android: test_posix fails.
msg264794 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-05-04 08:22
> Xavier, please check that issues with ctypes and threading are not gone.

No ctypes still crashes and threading still hangs.
History
Date User Action Args
2022-04-11 14:58:30adminsetgithub: 71119
2016-05-21 07:06:39xdegayelinkissue26865 dependencies
2016-05-04 08:22:38xdegayesetmessages: + msg264794
2016-05-04 08:05:08xdegayesetmessages: + msg264792
2016-05-04 07:55:46xdegayesetmessages: + msg264788
2016-05-04 06:58:25serhiy.storchakasetmessages: + msg264783
2016-05-04 06:47:18serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg264782

stage: patch review -> resolved
2016-05-04 06:45:21python-devsetnosy: + python-dev
messages: + msg264781
2016-05-04 06:08:23serhiy.storchakasetnosy: + amaury.forgeotdarc, belopolsky, pitrou, meador.inge

stage: patch review
title: android: test_posix fails -> RTLD_* macros are not defined on Android
2016-05-04 06:06:38yan12125setfiles: + rtld_constants.patch

messages: + msg264780
2016-05-04 04:50:26serhiy.storchakasetnosy: + vstinner
2016-05-04 04:49:15serhiy.storchakasetmessages: + msg264778
2016-05-04 04:20:22serhiy.storchakasetassignee: serhiy.storchaka
2016-05-04 03:50:44yan12125setmessages: + msg264777
2016-05-04 03:31:34yan12125setfiles: + posixmodule_rtld_constants.patch
keywords: + patch
messages: + msg264776
2016-05-04 02:54:00yan12125setnosy: + yan12125
messages: + msg264774
2016-05-03 21:54:30serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg264772
2016-05-03 14:44:04xdegayecreate