Message 310952 - Python tracker

Message310952

Author yan12125
Recipients ned.deily, pmpp, vstinner, yan12125
Date 2018-01-28.15:11:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1517152286.73.0.467229070634.issue32654@psf.upfronthosting.co.za>
In-reply-to
Content
Here are some ideas after testing:

* Testing environment:
 - My building scripts at https://github.com/yan12125/python3-android/
 - Android NDK r16b
 - Google's emulator image 'system-images;android-19;default;x86'

* Ideas/findings:
 - Locale emulation for setlocale() no longer works as _locale builds fine.

>>> locale.setlocale(locale.LC_ALL, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/local/tmp/python3/usr/lib/python3.7/locale.py", line 608, in setlocale
    return _setlocale(category, locale)
locale.Error: locale query failed

 - Declarations for mmap/sendfile shouldn't be necessary. In Android NDK r16b, sendfile() is defined if __USE_FILE_OFFSET64 is not defined: (from $ANDROID_NDK/sysroot/usr/include/sys/sendfile.h)

#if defined(__USE_FILE_OFFSET64)

#if __ANDROID_API__ >= 21
ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count) __RENAME(sendfile64) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */

#else
ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count);
#endif

#if __ANDROID_API__ >= 21
ssize_t sendfile64(int __out_fd, int __in_fd, off64_t* __offset, size_t __count) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */

__USE_FILE_OFFSET64 is defined as _FILE_OFFSET_BITS is defined to 64 in pyconfig.h. An NDK developer suggest "stop defining _FILE_OFFSET_BITS=64 on 32-bit Android." (https://github.com/android-ndk/ndk/issues/536#issuecomment-333197557) Either disabling large file support on Android or simply don't define _FILE_OFFSET_BITS on Android should work.   (Android does not use _LARGEFILE_SOURCE)

 - SIGRTMIN/SIGRTMAX: This is a bug on older NDK. r15 has fixed it (https://github.com/android-ndk/ndk/issues/352). I propose to wait until CPython builds with NDK r15+. I don't like adding patches for a known bug in older toolchains and revert them later.
History
Date User Action Args
2018-01-28 15:11:26yan12125setrecipients: + yan12125, vstinner, ned.deily, pmpp
2018-01-28 15:11:26yan12125setmessageid: <1517152286.73.0.467229070634.issue32654@psf.upfronthosting.co.za>
2018-01-28 15:11:26yan12125linkissue32654 messages
2018-01-28 15:11:26yan12125create