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.

Title: Build fails on AIX with _LINUX_SOURCE_COMPAT flag
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ericvw, martin.panter, python-dev, sarterm
Priority: normal Keywords: patch

Created on 2016-09-07 15:21 by sarterm, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
Python-3.5.1-compat.patch sarterm, 2016-09-07 15:21 Patch to allow using _LINUX_SOURCE_COMPAT when building on AIX
Messages (7)
msg274819 - (view) Author: Matthieu S (sarterm) * Date: 2016-09-07 15:21
Python build fails on AIX when using the _LINUX_SOURCE_COMPAT flag.

When using this flag, the gethostbyname_r subroutine has 6 parameters instead of 3, like on Linux, but Modules/socketmodule.c always expects a gethostbyname_r subroutine with only 3 parameters on AIX.

The attached patch allows to build with this flag. It has been tested for Python 3.5.1 and 3.5.2 with GCC and XLC compilers.
msg274971 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-08 05:58
Would it be appropriate to always build with _LINUX_SOURCE_COMPAT enabled or disabled? Or is there a disadvantage (e.g. compatibility with different AIX versions, or less functionality?)

Do you know if this would also be applicable to 2.7?
msg274972 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-08 06:06
Also, there is code in to detect 3- and 6-arg versions. Perhaps can we use that in all cases for AIX (as for Linux)?

The configure logic was overridden a long time ago: revision dad14ffe1c22. But I don’t know exactly why.
msg280295 - (view) Author: Matthieu S (sarterm) * Date: 2016-11-08 12:08
Sorry for the very late reply...

Using _LINUX_SOURCE_COMPAT is sometimes preferable, as it greatly improves compatibility with code intended for Linux and improves XPG specs compliance.

But I am not sure it should always be enabled.

In our case, we use it as there where issues with AIX malloc and hotshot when building without it, but Python seems to globally work fine without, and we did not compare performances.

Like you, I don't know why this was overridden, so it might be safer to keep the override and just add the #ifdef _LINUX_SOURCE_COMPAT.

This also applies to Python 2.7.
msg280732 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-14 05:39
New changeset 7598e65a924e by Martin Panter in branch '3.5':
Issue #28000: Fix gethostbyname_r() usage on AIX with _LINUX_SOURCE_COMPAT

New changeset 77cb8fa47138 by Martin Panter in branch '2.7':
Issue #28000: Fix gethostbyname_r() usage on AIX with _LINUX_SOURCE_COMPAT
msg280735 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-11-14 07:12
I committed your patches for 3.5+ and 2.7.
msg280927 - (view) Author: Matthieu S (sarterm) * Date: 2016-11-16 08:20
Thanks !
Date User Action Args
2022-04-11 14:58:35adminsetgithub: 72187
2016-11-16 08:22:36sartermsetversions: + Python 3.7
2016-11-16 08:21:15sartermsetstatus: open -> closed
resolution: fixed
2016-11-16 08:20:27sartermsetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg280927

versions: - Python 3.7
2016-11-14 07:12:22martin.pantersetstatus: open -> closed
versions: + Python 3.7
messages: + msg280735

resolution: fixed
stage: patch review -> resolved
2016-11-14 05:39:13python-devsetnosy: + python-dev
messages: + msg280732
2016-11-08 12:08:14sartermsetmessages: + msg280295
2016-09-08 06:06:18martin.pantersetmessages: + msg274972
versions: + Python 2.7
2016-09-08 05:58:51martin.pantersetversions: + Python 3.6
nosy: + martin.panter

messages: + msg274971

stage: patch review
2016-09-07 16:00:25ericvwsetnosy: + ericvw
2016-09-07 15:21:43sartermcreate