Mailinglist Archive: opensuse-packaging (116 mails)

< Previous Next >
Re: [opensuse-packaging] Python and CFLAGS
  • From: Cristian Morales Vega <reddwarf@xxxxxxxxxxxx>
  • Date: Fri, 31 May 2013 09:51:27 +0100
  • Message-id: <CAOWQn3RHGjUBKZip_JtDdaY=YfDMZinqU+Q+-hep_GGenznPHQ@mail.gmail.com>
On 30 May 2013 18:56, Jan Engelhardt <jengelh@xxxxxxx> 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@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation