[Python-Dev] C99

Nathaniel Smith njs at pobox.com
Sat Oct 8 12:42:34 EDT 2016


On Sat, Oct 8, 2016 at 9:23 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Thu, Oct 06, 2016 at 10:10:54PM -0700, Nathaniel Smith wrote:
>
>> The reason this matters is that the official vendor compiler on RHEL 5
>> is gcc 4.1, but there's also a separately-distributed version of gcc
>> 4.8.2 that can target it.
>
> Where can I get that 4.8 for RHEL 5?
>
> I'm using Centos 5, which ought to be the same as RHEL 5, and the
> standard gcc is 4.1, with 4.4 available through yum. If 4.8 is available
> anywhere, I haven't been able to find it. And as far as I can see, 3.6
> won't build under either 4.1 or 4.4 on Centos 5.

It's RH's "devtoolset" release. The build scripts for the manylinux
docker images demonstrate how to install them:

https://github.com/pypa/manylinux/blob/master/docker/build_scripts/build.sh#L38

(Unfortunately this involves installing them from a random CentOS
dev's home directory over plain-HTTP, but that's the only way to get
them if you don't have the appropriate RHEL subscription -- see
https://github.com/pypa/manylinux/issues/46#issuecomment-205054077)

>> If a packager trying to build manylinux
>> wheels wants a more modern gcc, then it's reasonable to ask them to
>> get this patched gcc. But for an end-user who's just trying to build
>> CPython on their machine, you might or might not consider this an
>> acceptable request -- maybe CPython wants to work on default vendor
>> compiler to imposing that on users.
>>
>> And in practice this almost certainly doesn't matter -- the only
>> reason people jump through hoops to get gcc 4.8 is for its improved
>> C++ support. I just tried my c99 test file on CentOS 5's default gcc
>> 4.1 and it was fine.
>
> Can you try building Python 3.6? Because it fails for me, and the
> discussion here:
>
> http://bugs.python.org/issue28092
>
> concluded that 4.1 is not supported and I'm right out of luck until I
> can upgrade.

I don't have time to follow up right now, but something like

  docker run -v $PWD:/io -it --rm quay.io/pypa/manylinux1_x86_64 /bin/bash

should drop you into a shell in a temporary centos5 VM where 'gcc' is 4.8.2.

>From the bug report it sounds like the issue is that my comments above
about 'we only care about static inline' were wrong, or at least,
Benjamin disagrees :-). I guess the revised version is
- if we insist on full C99 inline support, then that means dropping
support for building with vendor gcc on CentOS 5 and OS X (and
possibly dropping support for older OS X altogether?)
- if we are willing to restrict ourselves to 'static inline' and forgo
the other 'inline' variants, then all the other C99 things we care
about are fine and we can keep support for vendor gcc on CentOS 5 and
OS X.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-Dev mailing list