Re: overriding default compile flags when building python extensions

2019-05-03 Thread Drew Parsons

Ansgar wrote:

On Fri, 2019-05-03 at 19:49 +0800, Drew Parsons wrote:
> The first -g is the problem (in "-DNDEBUG -g -fwrapv -O2 -Wall").

Not sure about setup.py, but `-g0` (after `-g`) should also disable
debug information:

+---
| Level 0 produces no debug information at all.  Thus, -g0 negates -g.
+---



Thanks Ansgar. Weird (dangerous, even) if the flags can't be controlled 
directly.

But I can try the -g0 trick and see if it solves the problem.

Drew



Re: overriding default compile flags when building python extensions

2019-05-03 Thread Ansgar
On Fri, 2019-05-03 at 19:49 +0800, Drew Parsons wrote:
> 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.

Not sure about setup.py, but `-g0` (after `-g`) should also disable
debug information:

+---
| Level 0 produces no debug information at all.  Thus, -g0 negates -g.
+---

Ansgar



overriding default compile flags when building python extensions

2019-05-03 Thread Drew Parsons

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=i386=0.3.1-1=1556128605=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