[ python-Bugs-969718 ] BASECFLAGS are not passed to module build line

SourceForge.net noreply at sourceforge.net
Fri Jan 26 21:47:11 CET 2007


Bugs item #969718, was opened at 2004-06-09 17:56
Message generated for change (Comment added) made by marienz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=969718&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jason Beardsley (vaxhacker)
Assigned to: Nobody/Anonymous (nobody)
Summary: BASECFLAGS are not passed to module build line

Initial Comment:
The value of BASECFLAGS from
/prefix/lib/pythonver/config/Makefile is not present on
the compile command for modules being built by
distutils ("python setup.py build").  It seems that
only the value of OPT is passed along.

This is insufficient when BASECFLAGS contains
"-fno-static-aliasing", since recent versions of gcc
will emit incorrect (crashing) code if this flag is not
provided, when compiling certain modules (the mx
products from egenix, for example).

I did try to set CFLAGS in my environment, as directed
by documentation, but this also had zero effect on the
final build command.


----------------------------------------------------------------------

Comment By: Marien Zwart (marienz)
Date: 2007-01-26 21:47

Message:
Logged In: YES 
user_id=857292
Originator: NO

I'm seeing a variation of this bug in python 2.5.

As far as I can tell in python 2.4.3 on linux it passes BASECFLAGS and
OPT, appending CFLAGS from the environment to that if set. In python 2.5 it
passes CFLAGS from the Makefile (which is defined as $(BASECFLAGS) $(OPT)
$(EXTRA_CFLAGS)), or OPT and the CFLAGS from the environment if CFLAGS is
set there (this change was made in revision 45232). That means that if you
run setup.py with CFLAGS set they must include -fno-strict-aliasing if
using python 2.5.

I think it would be preferable to prepend BASECFLAGS instead of OPT if
CFLAGS is set in the environment. On my linux machine after building python
2.5 with CFLAGS set to "-O2 -march=athlon-xp" the Makefile has:

OPT=            -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
BASECFLAGS=      -fno-strict-aliasing
CFLAGS=         $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)

If I run a setup.py with CFLAGS unset it runs:

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC ...

Which is reasonable. If I run it with CFLAGS="-O2 -march=athlon-xp":

gcc -pthread -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -O2
-march=athlon-xp -fPIC ...

Which misses -fno-strict-aliasing and still includes all the general flags
that I'm trying to set through CFLAGS.

If it used BASECFLAGS from the Makefile instead of OPT it would be:

gcc -pthread -fno-strict-aliasing -O2 -march=athlon-xp -fPIC ...

Which is what I think is the desired result here.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-04-12 10:05

Message:
Logged In: YES 
user_id=21627

I don't think I will do anything about this anytime soon, so
unassigning myself.

----------------------------------------------------------------------

Comment By: nyogtha (nyogtha)
Date: 2006-01-13 22:19

Message:
Logged In: YES 
user_id=1426882

This is still a bug in Python 2.4.2.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=969718&group_id=5470


More information about the Python-bugs-list mailing list