[opensuse-packaging] Python and CFLAGS
![](https://seccdn.libravatar.org/avatar/576633d48951f8e887a5df4f8707451a.jpg?s=120&d=mm&r=g)
I am trying to compile in openSUSE 12.3 a program which uses "waf" to build. It fails to detect Python.h because the test program is compiled with -O0 and -D_FORTIFY_SOURCE=2, and you can't use both at the same time. The FORTIFY_SOURCE part comes from waf using: "get_config_var('CFLAGS')". And from what I can see that gets the CFLAGS used to build python itself from %{_libdir}/python2.7/config/Makefile, from the python-base package. Now, I don't know the first thing about the "Python way". So, can somebody answer: - There is really some use for Python defining this CFLAGS "config_var"? - It's normal for the build systems to try to retrieve get_config_var('CFLAGS')? Why? - We really need a Makefile in python-base? - And %{_libdir}/python2.7/config/Makefile.pre and %{_libdir}/python2.7/config/Makefile.pre.in in python-devel? - Should the python package be patched to remove "%{optflags}" from %{_libdir}/python2.7/config/Makefile? Thanks. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/5b748275c3dbb1ceee18ed554486547d.jpg?s=120&d=mm&r=g)
On Thursday 2013-05-30 17:31, Cristian Morales Vega wrote:
I am trying to compile in openSUSE 12.3 a program which uses "waf" to build. It fails to detect Python.h because the test program is compiled with -O0 and -D_FORTIFY_SOURCE=2, and you can't use both at the same time.
The FORTIFY_SOURCE part comes from waf using: "get_config_var('CFLAGS')". And from what I can see that gets the CFLAGS used to build python itself from %{_libdir}/python2.7/config/Makefile, from the python-base package.
Now, I don't know the first thing about the "Python way". So, can somebody answer:
- There is really some use for Python defining this CFLAGS "config_var"? - It's normal for the build systems to try to retrieve get_config_var('CFLAGS')? Why?
Downstream programs usually only need CPPFLAGS containing the -I arguments to get to the header files. Sometimes they also include -D args, but that reeks of "gee, could you not have put that into some config.h". C(XX)FLAGS is then for things like -pthread which may at times be wanted. Now, some build scripts that have not received enough love to distinguish between CPPFLAGS and CFLAGS, so the -Is and -Ds may be found in some CFLAGS instead. In any case, CFLAGS on how the library was built is seldom useful; what is needed are CFLAGS for library _users_. And if those contain -f, -g and -O is just screwing around with users. Like `mysql-config --cflags` (but at least, mysql has --include as alternative) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/576633d48951f8e887a5df4f8707451a.jpg?s=120&d=mm&r=g)
On 30 May 2013 18:56, Jan Engelhardt <jengelh@inai.de> wrote:
On Thursday 2013-05-30 17:31, Cristian Morales Vega wrote:
I am trying to compile in openSUSE 12.3 a program which uses "waf" to build. It fails to detect Python.h because the test program is compiled with -O0 and -D_FORTIFY_SOURCE=2, and you can't use both at the same time.
The FORTIFY_SOURCE part comes from waf using: "get_config_var('CFLAGS')". And from what I can see that gets the CFLAGS used to build python itself from %{_libdir}/python2.7/config/Makefile, from the python-base package.
Now, I don't know the first thing about the "Python way". So, can somebody answer:
- There is really some use for Python defining this CFLAGS "config_var"? - It's normal for the build systems to try to retrieve get_config_var('CFLAGS')? Why?
Downstream programs usually only need CPPFLAGS containing the -I arguments to get to the header files. Sometimes they also include -D args, but that reeks of "gee, could you not have put that into some config.h".
C(XX)FLAGS is then for things like -pthread which may at times be wanted.
Now, some build scripts that have not received enough love to distinguish between CPPFLAGS and CFLAGS, so the -Is and -Ds may be found in some CFLAGS instead.
In any case, CFLAGS on how the library was built is seldom useful; what is needed are CFLAGS for library _users_. And if those contain -f, -g and -O is just screwing around with users. Like `mysql-config --cflags` (but at least, mysql has --include as alternative)
The thing is that I don't know what's the intended use of that specific CFLAGS variable in Python. So I don't know if the variable in our package is wrong, or if it's correct but waf is misusing it. I have been looking into it and all comes to this: def get_config_vars(*args): """With no arguments, return a dictionary of all configuration variables relevant for the current platform. Generally this includes everything needed to build extensions and install both pure modules and extensions. On Unix, this means every variable defined in Python's installed Makefile; on Windows and Mac OS it's a much smaller set. With arguments, return a list of values that result from looking up each argument in the configuration variable dictionary. """ from %{_libdir}/python2.7/distutils/sysconfig.py. So, can someone with Python knowledge explain if there is any specific CFLAGS "needed to build extensions and install both pure modules and extensions"? I am starting to consider this a "distutils" bug. Why is Unix treated in a different way? I don't like that "On Unix, this means every variable defined in Python's installed Makefile; on Windows and Mac OS it's a much smaller set." -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/9b157812a3adabf7f9106f9a56145b3e.jpg?s=120&d=mm&r=g)
Dnia czwartek, 30 maja 2013 19:56:13 Jan Engelhardt pisze:
Downstream programs usually only need CPPFLAGS containing the -I arguments to get to the header files. Sometimes they also include -D args, but that reeks of "gee, could you not have put that into some config.h".
Unless you need -D_RESERVED_IDENTIFIER, that is. Chris -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Cristian Morales Vega
-
Jan Engelhardt
-
Křištof Želechovski