GNOME Bugzilla – Bug 580662
mutter compile problem on Solaris
Last modified: 2009-06-12 18:51:06 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?
Created attachment 133529 [details] [review] patch fixing issue.
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
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 ?
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.)
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() */
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.
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