After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 339924 - pygobject doesn't compile on opensolaris
pygobject doesn't compile on opensolaris
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
Git master
Other opensolaris
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
: 437205 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-04-27 14:00 UTC by James Andrewartha
Modified: 2007-08-27 12:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove -std=c9x and -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ (1.16 KB, patch)
2007-08-24 07:40 UTC, Carsten Clark
none Details | Review

Description James Andrewartha 2006-04-27 14:00:34 UTC
gnome-python (pygobject, pycairo, pyorbit) doesn't compile on opensolaris. It fails with the following #error:

http://jhbuild.bxlug.be/builds/2006-04-27-0002/logs/gnome-python%5Cpygobject/#build

/usr/include/sys/feature_tests.h:353:2: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications 	and pre-2001 POSIX applications"

The relevant part of /usr/include/feature_tests.h is:

/*
 * It is invalid to compile an XPG3, XPG4, XPG4v2, or XPG5 application
 * using c99.  The same is true for POSIX.1-1990, POSIX.2-1992, POSIX.1b,
 * and POSIX.1c applications. Likewise, it is invalid to compile an XPG6
 * or a POSIX.1-2001 application with anything other than a c99 or later
 * compiler.  Therefore, we force an error in both cases.
 */
#if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
        and pre-2001 POSIX applications"
#elif !defined(_STDC_C99) && \
        (defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
        require the use of c99"
#endif

so I think you need to #define _XPG6 for it to work.
Comment 1 Johan (not receiving bugmail) Dahlin 2006-04-27 14:10:34 UTC
Seems like OpenSolaris does not like -std=c9x
Comment 2 Gustavo Carneiro 2006-05-02 15:53:14 UTC
This looks similar to bug 335240.
Comment 3 Gustavo Carneiro 2007-05-09 16:35:25 UTC
*** Bug 437205 has been marked as a duplicate of this bug. ***
Comment 4 Damien Carbery 2007-05-09 16:42:02 UTC
The Sun Studio compiler (used on OpenSolaris) doesn't like -Wall or -fno-strict-aliasing.
The patch at Bug 437205 should be an easy solution.
Comment 5 Gustavo Carneiro 2007-05-09 16:47:12 UTC
(In reply to comment #4)
> The Sun Studio compiler (used on OpenSolaris) doesn't like -Wall or
> -fno-strict-aliasing.

Are you sure itsn't not only c9x that's causing the problem?

> The patch at Bug 437205 should be an easy solution.
 
I committed something else, based on comments in http://wiki.netbsd.se/index.php/Typical_pkgsrc_error_messages.
Comment 6 Damien Carbery 2007-05-09 16:53:33 UTC
$ cat me.c 
#include <stdio.h>

int main(void)
{
  printf("Hello\n");
}

$ cc -V
cc: Sun C 5.8 Patch 121016-05 2007/01/10
usage: cc [ options] files.  Use 'cc -flags' for details
$ cc -Wall me.c
cc: illegal option -Wall
$ cc -fno-strict-aliasing me.c
cc: Warning: illegal option -fno-strict-aliasing
$ cc -std=c9x me.c
cc: Warning: illegal option -d=c9x
Comment 7 Gustavo Carneiro 2007-05-09 17:16:48 UTC
(In reply to comment #6)
> $ cat me.c 
> #include <stdio.h>
> 
> int main(void)
> {
>   printf("Hello\n");
> }
> 
> $ cc -V
> cc: Sun C 5.8 Patch 121016-05 2007/01/10
> usage: cc [ options] files.  Use 'cc -flags' for details
> $ cc -Wall me.c
> cc: illegal option -Wall
> $ cc -fno-strict-aliasing me.c
> cc: Warning: illegal option -fno-strict-aliasing
> $ cc -std=c9x me.c
> cc: Warning: illegal option -d=c9x

What is the exit code ($?) of the compiler in each case?
Comment 8 Damien Carbery 2007-05-09 17:34:40 UTC
$ cc -V; echo $?
cc: Sun C 5.8 Patch 121016-05 2007/01/10
usage: cc [ options] files.  Use 'cc -flags' for details
1
$ cc -Wall me.c; echo $?
cc: illegal option -Wall
1
$ cc -fno-strict-aliasing me.c; echo $?
cc: Warning: illegal option -fno-strict-aliasing
0
$ cc -std=c9x me.c; echo $?
cc: Warning: illegal option -d=c9x
0
$ cc me.c; echo $? 
0
Comment 9 Gustavo Carneiro 2007-05-09 17:42:41 UTC
configure.ac has several invocations of the JH_ADD_CFLAG macro, which tries to compile something and see if an error is produced.  Apparently only -Wall is really an error; the rest are just warnings.  It Should Work™.

But -std=c9x is worrying: from the error message it seems that the compiler accepts -s and -t, and god knows what side effects these switches cause. :|

It's probably safer to just apply your patch.
Comment 10 Gustavo Carneiro 2007-07-07 13:58:08 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 11 Carsten Clark 2007-08-24 07:29:10 UTC
This doesn't work for me on Solaris 10 using GCC.  Python 2.5.1's pyconfig.h defines _XOPEN_SOURCE=500, which overrides pygobject's command-line option, -D_XOPEN_SOURCE=600.  This leads to the feature_tests.h error originally reported by James Andrewartha.

According to Solaris 10's standards(5) man page, defining _XOPEN_SOURCE=500 requests SUSv2 and requires the use of a C89 compiler, whereas defining _XOPEN_SOURCE=600 requests SUSv3 and requires using a C99 compiler.  feature_tests.h enforces this.

I was able to fix my build by removing -std=c9x from configure.ac and removing -D_XOPEN_SOURCE=600 -D__EXTENSIONS__ from gobject/Makefile.am and tests/Makefile.am.  If you don't need C99 or the SUSv3 features (whatever they are), then maybe this will work for everyone (?).
Comment 12 Carsten Clark 2007-08-24 07:40:33 UTC
Created attachment 94236 [details] [review]
Remove -std=c9x and -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
Comment 13 Gustavo Carneiro 2007-08-27 12:47:59 UTC
Removed-D_XOPEN_SOURCE=600 and -D__EXTENSIONS__, conditionally removed -std=c9x only on solaris.  Should be fixed for real now.