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
gethostbyname_r() is broken on android #71044
Comments
HAVE_GETHOSTBYNAME_R is defined on android API 21, but importing the _socket module fails with:
Patch attached. |
New changeset eb19ad1918cd by Stefan Krah in branch 'default': |
Thanks, fixed. |
gethostbyaddr_r() is implemented now on Android 6.0 (API 23). The attached patch has been tested on the android-21-x86 emulator (API 21) and android-23-x86 emulator (API 23). No new NDK has been released at Android 5.1 (API 22) so there is no need to test the patch for this release. |
How about supporting API >= 23 only? Can people upgrade their devices or do they have to buy a new one? |
AFAIK most models other than Nexus won't get updates with a bumped major version. (5.x => 6.x for example) |
By the way, socketmodule_2.patch is problematic. Developers may choose to build CPython against API level 21 and run it on all devices with API level >= 21. In general Android keeps ABI compatibility between consecutive versions. That is, most binaries built for API 21 can be run on API 21, 22, 23 and 24. With this patch, developers have to build two versions of CPython, one for API < 23 and one for API >= 23, or gethostbyname_r() may not be used. |
So what is problematic with this new patch ? Obviously you need to build with API 23 to get gethostbyname_r() since it was not supported by android before, with the previous patch you don't get gethostbyname_r(), even when building with API 23. |
I was thinking the (somewhat hacky) dlopen() approach so that gethostbyname_r() works in API 21 builds. If a universal build is not necessary this patch is OK. |
Okay thanks, let's assume api-level >= 21 for now. I've moved the include into pyport.h in order to save a little space everywhere. Could you check if that works? |
and also fixed the error in my patch, thanks :) With bpo-26857.diff, importing the socket module does not fail both with an API 21 emulator and an API 23 emulator. |
New changeset 09af54099973 by Stefan Krah in branch 'default': |
Thanks! Closing again. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: