[Wheel-builders] manylinux compile/optimization options

Marcel Martin mail at marcelm.net
Wed Dec 6 13:29:05 EST 2017


On 2017-12-06 11:56, Vlad K. wrote:
> I need to understand if there are any specific compilation options set
> for the manylinux precompiled binaries, by the packaging system or by
> individual python module developers.
[...]
> Now, since -O3 is not a wise thing to do [...]

Why do you think so? As far as I know, using -O3 is perfectly normal and
safe!

When you compile Python from sources - at least on Linux -, it sets -O3
by default and this is propagated into the default CFLAGS that
setuptools/distutils use for compiling extensions.

I’m not quite sure how exactly setuptools/distutils derive the actual
CFLAGS, but you can run 'python -m sysconfig' or 'python-config
--cflags' to see lots of configuration settings that have to do with
CFLAGS. You can run this to check the manylinux1 Docker image, for example:

$ docker run quay.io/pypa/manylinux1_x86_64
/opt/python/cp36-cp36m/bin/python3.6-config --cflags

This outputs:
-I/opt/_internal/cpython-3.6.0/include/python3.6m
-I/opt/_internal/cpython-3.6.0/include/python3.6m  -Wno-unused-result
-Wsign-compare -Wformat -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

I would suggest that you check how your FreeBSD Python was compiled.
Perhaps the solution is to ensure that it is compiled with -O3. If it
works as on Linux, I would assume that then all C extensions would also
be compiled with -O3.

Regards,
Marcel


More information about the Wheel-builders mailing list