GNOME Bugzilla – Bug 472089
-std=c99 breaks build on Solaris 10 w/ Python 2.5.1
Last modified: 2007-09-01 20:54:21 UTC
Pycairo and Pygtk include Python headers and use -std=c99 (or -std=c9x). 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 the -std=c99 (or c9x) allows the build to complete. I recently commented on a similar bug in Pygobject (#339924), and Gustavo Carneiro conditionally removed -std=c9x on Solaris, which fixed the problem for me in Pygobject. However, perhaps -std=c99 (or c9x) is not needed anywhere anymore. Pygtk's ChangeLog-pre-2-0 includes: 2002-01-31 James Henstridge <james@daa.com.au> * configure.in: increment version number of package and requirements. Change -ansi to -std=c9x to work arround potential problems with gcc 2.95.x. Does GCC 2.95 still need to be supported? (Especially since the minimum Python version is from 2003?) If not, perhaps -std=c99 could be droppend entirely. 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" 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/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"
Created attachment 94684 [details] [review] Don't add -std=c99 in pycairo/configure.ac This fixes the Pycairo build for me (Solaris 10, GCC 3.4.3, Python 2.5.1).
Created attachment 94685 [details] [review] Don't add -std=c9x in pygtk/configure.in This fixes the Pygtk build for me. (Apologies for creating so much e-mail traffic.)
Which pygtk version is this? -stdc9x is supposedly removed on Solaris since pygtk 2.11.0. And we have nothing to do with pycairo; for that, go to https://bugs.freedesktop.org/index.cgi
Gustavo, My bad on both counts! Obviously you had already fixed this, while I was forgetting to update my SVN from r2888. And obviously I forgot where I got pycairo from. Pygtk trunk (r2899) builds & installs fine for me now. Sorry for the unnecessary trouble; I'll be more careful next time.