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 580662 - mutter compile problem on Solaris
mutter compile problem on Solaris
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other opensolaris
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2009-04-28 22:15 UTC by Brian Cameron
Modified: 2009-06-12 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch fixing issue. (407 bytes, patch)
2009-04-28 22:16 UTC, Brian Cameron
none Details | Review
updated patch (741 bytes, patch)
2009-04-28 22:21 UTC, Brian Cameron
none Details | Review

Description Brian Cameron 2009-04-28 22:15:51 UTC
If I compile mutter on Solaris, I get this error when I try to compile src/compositor/mutter/compositor-mutter.c:

#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
        require the use of c99"

Changing the #define of _XOPEN_SOURCE from 500 to 600 fixes this problem.  See patch.  Can this go upstream?
Comment 1 Brian Cameron 2009-04-28 22:16:16 UTC
Created attachment 133529 [details] [review]
patch fixing issue.
Comment 2 Brian Cameron 2009-04-28 22:21:11 UTC
Created attachment 133530 [details] [review]
updated patch


Sorry, I filed that bug too fast.  The error message is actually:

#error: "Compiler or opt
ions invalid for pre-UNIX 03 X/Open applications        and pre-2001 POSIX appli
cations"

And two files are affected.  This patch fixes both files
Comment 3 Tomas Frydrych 2009-04-29 08:00:28 UTC
Actually, the define _XOPEN_SOURCE in compositor-mutter.c can be removed (I am pretty sure that is just a leftover from the file being initially cloned from the xrender compositor). I have no objections to bumping it to 600 in the xrender compositor for now (I assume we are going to nuke the xrender compositor in the foreseable future anyway). Owen, any objections to this ?
Comment 4 Owen Taylor 2009-04-29 15:53:53 UTC
I guess if I was actually trying to figure out the root cause of this problem, I'd wonder why SFEmutter.spec does:

export CFLAGS="%optflags -xc99 -I/usr/include/clutter-0.9"

AFAIK, like the rest of GNOME we are still avoiding C99 features (like mixed code and declarations in Mutter). That's what is causing the XOPEN_SOURCE value of 500 to blow up, right?

But removing it entirely in compositer-mutter.c (where we don't use usleep) and bumping it in compositor-xrender.c (which is going to be removed) sounds fine to me. (If there are C99'isms, it probably would be good to report them.)
Comment 5 Brian Cameron 2009-04-29 16:18:35 UTC
Owen, thanks for looking into this.  If I avoid using -xc99 on the compile line,
then I get this error when building quite a few files (listed below):

   #error: "Compiler or options invalid; UNIX 03 and POSIX.1-2001 
            applications       require the use of c99"

But if I comment out the following lines in the following files, then I can compile without the -xc99 flag.  If you say a better fix would be to remove these lines, then I am happy with that solution.

src/toolsmetacity-mag:

#define _XOPEN_SOURCE 600 /* C99 -- for rint() */

src/core/utils.c:

#define _POSIX_C_SOURCE 200112L /* for fdopen() */

src/ui/preview-widget.c:

#define _XOPEN_SOURCE 600 /* for the maths routines over floats */

src/compositor/compositor-xrender.c:

#define _XOPEN_SOURCE 600 /* for usleep() */

src/compositor/mutter/compositor-mutter.c:

#define _XOPEN_SOURCE 600 /* for usleep() */
Comment 6 Owen Taylor 2009-04-29 17:03:40 UTC
I don't really have any understanding of the interaction of command line options and header file defines on Solaris. Let's just go for the simple solution of removing the #define from compositor-mutter.c and bumping it to 600 in compositor-xrender.c.
Comment 7 Owen Taylor 2009-06-12 18:51:06 UTC
Pushed a patch as discussed.

commit 627b4484ec030fce98903c0da153f8d52165312b
Author: Owen W. Taylor <otaylor@fishsoup.net>
Date:   Fri Jun 12 14:47:48 2009 -0400

    Fix _XOPEN_SOURCE compilation problems on Solaris
    
    Change #define _XOPEN_SOURCE 500 to 600 in compositor-xrender.c to
    avoid a bad interaction with -xc99 on Solaris.
    
    Remove unneeded #define in compositor-mutter.c.
    
    Based on a patch by Brian Cameron