Bug 12366 - -std=c99 breaks build on Solaris 10 w/ Python 2.5.1
Summary: -std=c99 breaks build on Solaris 10 w/ Python 2.5.1
Status: RESOLVED NOTOURBUG
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Solaris
: medium normal
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-08 14:00 UTC by Carsten Clark
Modified: 2008-07-16 16:36 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Carsten Clark 2007-09-08 14:00:22 UTC
Pycairo includes Python headers and uses -std=c99 in its CFLAGS.  On Solaris 10, Python 2.5.1's pyconfig.h defines _XOPEN_SOURCE=500.  Solaris's <sys/feature_tests.h> balks when a C99 compiler is used in combination with _XOPEN_SOURCE=500.  Removing -std=c99 allows the build to complete.

Similar bugs were occurring in the Gnome projects Pygobject and Pygtk.  They were fixed by checking whether the host OS is Solaris before adding -std=c9x to CFLAGS.  See:

http://bugzilla.gnome.org/show_bug.cgi?id=339924
http://bugzilla.gnome.org/show_bug.cgi?id=472089

(I reported the latter bug by mistake, not realizing that it had already been fixed and that Pycairo was not a Gnome project!)

I have Solaris 10 11/06 with the stock GCC (3.4.3) and Sun linker.  I built and
installed Python 2.5.1 (my config.log says "./configure --enable-shared"). 
Here's the error when building Pycairo:

gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include/python2.5
-I/usr/local/include/cairo -I/usr/sfw/include -I/usr/sfw/include/freetype2
-I/usr/include/libpng12 -g -O2 -std=c99 -Wall -fno-strict-aliasing -MT
_cairo_la-pycairo-context.lo -MD -MP -MF .deps/_cairo_la-pycairo-context.Tpo -c
pycairo-context.c  -fPIC -DPIC -o .libs/_cairo_la-pycairo-context.o
In file included from /usr/include/limits.h:18,
                 from /usr/local/include/python2.5/Python.h:18,
                 from pycairo-context.c:32:
/usr/include/sys/feature_tests.h:332:2: #error "Compiler or options invalid for
pre-UNIX 03 X/Open applications         and pre-2001 POSIX applications"

Python 2.3, which comes with Solaris 10, does not define _XOPEN_SOURCE.  Pycairo builds against Python 2.3 for me with no problems.

Some minimal test programs:

$ cat test.c
#define _XOPEN_SOURCE 500
#include <unistd.h>
$ gcc -std=c99 -c test.c
In file included from /usr/include/unistd.h:18,
                 from test.c:3:
/usr/include/sys/feature_tests.h:332:2: #error "Compiler or options invalid for
pre-UNIX 03 X/Open applications         and pre-2001 POSIX applications"

$ cat > pytest.c
#include <Python.h>
$ gcc -I/usr/local/include/python2.5 -c pytest.c
$ gcc -std=c99 -I/usr/sfw/include/python2.3 -c pytest.c
$ gcc -std=c99 -I/usr/local/include/python2.5 -c pytest.c
In file included from /usr/include/limits.h:18,
                 from /usr/local/include/python2.5/Python.h:18,
                 from pytest.c:1:
/usr/include/sys/feature_tests.h:332:2: #error "Compiler or options invalid for
pre-UNIX 03 X/Open applications         and pre-2001 POSIX applications"
Comment 1 Steve Chaplin 2007-09-10 07:38:20 UTC
If I understand correctly:
- with Python 2.3 everything is OK
- with Python 2.5.1 there is a conflict between the Python pyconfig.h and
 the Solaris 10 <sys/feature_tests.h>

So it does not look like a pycairo bug to me. It looks like a Python 2.5.1 /
Solaris bug; and a regression from Python 2.3. I suggest opening a Python
and/or Solaris bug report.
Comment 2 Steve Chaplin 2008-07-16 16:36:58 UTC
This does not look like a pycairo bug to me. I do not believe applying a workaround to hide the underlying Python or Solaris bug is a good idea.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.