Bug#928140: overriding default compile flags when building python extensions

Drew Parsons dparsons at debian.org
Fri May 3 12:49:18 BST 2019


Dear Debian Python community,

how does one control or override the default flags used by setup.py 
(setuptools module) when compiling a C extension for a python module?

The intention is to switch off -g in pygalmesh, because of memory 
constraints on 32 bit systems when compiling against CGAL, see 
Bug#928140, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928140

A failed build, e.g. i386 at 
https://buildd.debian.org/status/fetch.php?pkg=pygalmesh&arch=i386&ver=0.3.1-1&stamp=1556128605&raw=0
shows -g is used twice.  The second usage comes from CFLAGS in 
dpkg-buildflags, which I can control.

The first -g is the problem (in "-DNDEBUG -g -fwrapv -O2 -Wall").  The 
advice from the internet (stackoverflow) is exceedingly poor on this 
question, in most cases addressing how to add flags, not how to change 
the existing default flags. Alternatives like
   OPT="" python3 ./setup.py
simply do not work.

The default in question appears to be the OPT variable defined in 
/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu/Makefile

But how to override it?

Upstream (Nico) suggests instead to build with CC=clang++.  Is this a 
good alternative for Debian python modules?

Drew



More information about the debian-science-maintainers mailing list