classification
Title: python-config --cflags includes irrelevant flags
Type: behavior Stage:
Components: Build Versions: Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: Joe.Neeman, erickt, georg.brandl, loewis, sacha, terry.reedy
Priority: normal Keywords:

Created on 2008-07-05 19:09 by sacha, last changed 2010-07-12 23:35 by Joe.Neeman.

Messages (7)
msg69289 - (view) Author: Sacha Varma (sacha) Date: 2008-07-05 19:09
As I understand it, python-config --cflags is intended to yield the C
compiler flags needed to compile a program that uses Python headers and
libraries (as opposed to the C flags needed to compile python itself).

However, it seems to include irrelevant options such as -Wall and -O3,
which interfere with the build (for example, by enabling optimisation in
a debug build):

$ python-config --cflags
-I/opt/Python-2.5.1/include/python2.5
-I/opt/Python-2.5.1/include/python2.5 -fno-strict-aliasing
-Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes
msg69292 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-07-05 20:10
Georg, what do you think?
msg69317 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-07-06 06:19
I think you're right.

However, Martin, what flags except -I can/must we keep?
msg69320 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-07-06 06:43
Some flags for the compiler are really needed to compile the Python
headers correctly, e.g. -fno-strict-aliasing in 2.6.

So I think an explicit list of options reported would have to be
maintained, either as a blacklist (e.g. -O<n>, -Wall), or as a white list.
msg73878 - (view) Author: Erick Tryzelaar (erickt) Date: 2008-09-26 18:59
fyi, on the mac with gcc-4.2, distutils is erroring out because of the "-
Wno-long-double" it is getting from "python-config --cflags", as it's no 
longer accepted as an argument. Fortunately this can be worked around by 
doing "CC=gcc-4.0 python setup.py".
msg107977 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-06-17 01:11
Is this still an issue for current trunks?
msg110148 - (view) Author: Joe Neeman (Joe.Neeman) Date: 2010-07-12 23:35
It's still an issue in Python 2.6.5 as packaged by openSUSE 11.2.
History
Date User Action Args
2010-07-12 23:35:36Joe.Neemansetnosy: + Joe.Neeman
messages: + msg110148
2010-06-17 01:11:56terry.reedysetnosy: + terry.reedy

messages: + msg107977
versions: + Python 2.7, Python 3.2, - Python 2.5
2008-09-26 18:59:43ericktsetnosy: + erickt
messages: + msg73878
2008-07-06 06:43:32loewissetmessages: + msg69320
2008-07-06 06:19:02georg.brandlsetmessages: + msg69317
2008-07-05 20:10:50loewissetassignee: georg.brandl
messages: + msg69292
nosy: + loewis, georg.brandl
2008-07-05 19:09:06sachacreate