Compiz, X11, Glib, and general stupidity

Edit/Disclaimer: I must have been having a bad day when I originally wrote this. There’s some very questionable development practice discussed here but calling people (even and perhaps especially non-specific people) “jerks” was going too far. Apologies to anyone I offended with this post.

I’m currently in the process of trying to compile compiz, the compositor/window manager for X that’s been around for a long time now under various different names. The first snag I hit was that compiz isn’t housed where you might think, that is, the compiz website; instead it seems recent versions can be found in launchpad, where presumably various folks from Ubuntu have had their way with it. In any case, I’ve downloaded the source for version 0.9.12 from launchpad. On trying to build it (with “make VERBOSE=1”) I’m seeing this error:

[ 11%] Building CXX object src/CMakeFiles/compiz_core.dir/eventsource.cpp.o
cd /usr/src/compiz-0.9.12.0/build/src && /usr/bin/c++   -DHAVE_CONFIG_H -DHAVE_SCANDIR_POSIX -Dcompiz_core_EXPORTS -fPIC -Wall -Wno-unused-private-field -Wno-unused-local-typedefs -Wno-deprecated-declarations -Werror -fPIC -Wall -Wno-unused-private-field -Wno-unused-local-typedefs -Wno-deprecated-declarations -Werror -fPIC -Wall -Wno-unused-private-field -Wno-unused-local-typedefs -Wno-deprecated-declarations -Werror -O2 -g -DNDEBUG -fPIC -I/usr/src/compiz-0.9.12.0/include -I/usr/src/compiz-0.9.12.0/build -I/usr/src/compiz-0.9.12.0/build/generated -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/startup-notification-1.0 -I/usr/X11R7/include -I/include -I/usr/src/compiz-0.9.12.0/src -I/usr/src/compiz-0.9.12.0/src/string/include -I/usr/src/compiz-0.9.12.0/src/string/src -I/usr/src/compiz-0.9.12.0/src/logmessage/include -I/usr/src/compiz-0.9.12.0/src/logmessage/src -I/usr/src/compiz-0.9.12.0/src/timer/include -I/usr/src/compiz-0.9.12.0/src/timer/src -I/usr/src/compiz-0.9.12.0/src/pluginclasshandler/include -I/usr/src/compiz-0.9.12.0/src/pluginclasshandler/src -I/usr/src/compiz-0.9.12.0/src/point/include -I/usr/src/compiz-0.9.12.0/src/point/src -I/usr/src/compiz-0.9.12.0/src/rect/include -I/usr/src/compiz-0.9.12.0/src/rect/src -I/usr/src/compiz-0.9.12.0/src/servergrab/include -I/usr/src/compiz-0.9.12.0/src/servergrab/src -I/usr/src/compiz-0.9.12.0/src/region/include -I/usr/src/compiz-0.9.12.0/src/region/src -I/usr/src/compiz-0.9.12.0/src/window/geometry/include -I/usr/src/compiz-0.9.12.0/src/window/geometry/src -I/usr/src/compiz-0.9.12.0/src/window/geometry-saver/include -I/usr/src/compiz-0.9.12.0/src/window/geometry-saver/src -I/usr/src/compiz-0.9.12.0/src/window/extents/include -I/usr/src/compiz-0.9.12.0/src/window/extents/src -I/usr/src/compiz-0.9.12.0/src/window/constrainment/include -I/usr/src/compiz-0.9.12.0/src/window/constrainment/src    -DPLUGINDIR=\"/usr/lib/compiz\" -DSHAREDIR=\"/usr/share/compiz/\" -DMETADATADIR=\"/usr/share/compiz\" -o CMakeFiles/compiz_core.dir/eventsource.cpp.o -c /usr/src/compiz-0.9.12.0/src/eventsource.cpp
In file included from /usr/src/compiz-0.9.12.0/include/core/window.h:35:0,
                 from /usr/src/compiz-0.9.12.0/include/core/screen.h:31,
                 from /usr/src/compiz-0.9.12.0/src/eventsource.cpp:28:
/usr/X11R7/include/X11/Xregion.h:59:0: error: "TRUE" redefined [-Werror]
 #define TRUE 1
 ^
In file included from /usr/lib/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /usr/include/glibmm-2.4/glibmm/timeval.h:26,
                 from /usr/include/glibmm-2.4/glibmm/main.h:24,
                 from /usr/src/compiz-0.9.12.0/src/privateeventsource.h:30,
                 from /usr/src/compiz-0.9.12.0/src/eventsource.cpp:27:
/usr/include/glib-2.0/glib/gmacros.h:233:0: note: this is the location of the previous definition
 #define TRUE (!FALSE)
 ^
In file included from /usr/src/compiz-0.9.12.0/include/core/window.h:35:0,
                 from /usr/src/compiz-0.9.12.0/include/core/screen.h:31,
                 from /usr/src/compiz-0.9.12.0/src/eventsource.cpp:28:
/usr/X11R7/include/X11/Xregion.h:60:0: error: "FALSE" redefined [-Werror]
 #define FALSE 0
 ^
In file included from /usr/lib/glib-2.0/include/glibconfig.h:9:0,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /usr/include/glibmm-2.4/glibmm/timeval.h:26,
                 from /usr/include/glibmm-2.4/glibmm/main.h:24,
                 from /usr/src/compiz-0.9.12.0/src/privateeventsource.h:30,
                 from /usr/src/compiz-0.9.12.0/src/eventsource.cpp:27:
/usr/include/glib-2.0/glib/gmacros.h:229:0: note: this is the location of the previous definition
 #define FALSE (0)
 ^
cc1plus: error: unrecognized command line option "-Wno-unused-private-field" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-unused-private-field" [-Werror]
cc1plus: error: unrecognized command line option "-Wno-unused-private-field" [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/compiz_core.dir/eventsource.cpp.o] Error 1
make[2]: Leaving directory `/usr/src/compiz-0.9.12.0/build'
make[1]: *** [src/CMakeFiles/compiz_core.dir/all] Error 2
make[1]: Leaving directory `/usr/src/compiz-0.9.12.0/build'
make: *** [all] Error 2

I am astounded; it seems there are three separate packages in which the maintainers have displayed astonishing levels of ignorance and arrogance. First, and most obviously:

Compiz have released a source bundle which doesn’t build.

Oh, I’m sure it builds on some system with modified headers, as perhaps might be found on Ubuntu systems or others, but it doesn’t build against vanilla versions of the packages on which it depends – in this case libX11 and Glib, both fairly fundamental libraries (I have the most recent released versions of both).

As bad as this, however, it pales in comparison with the bone-headedness of the developers of those packages, who have both chosen to define constants, in the global namespace, called TRUE and FALSE.

Here’s a hint, you jerks:

Don’t do that.

I’m thinking that to work around this, I’ll just add “#undef TRUE” and “#undef FALSE” before the inclusion of Xregion.h (i.e. in compiz’s core/window.h). But it’s really a huge problem that they’re defined in the first place. Macros in the global namespace are bad enough without giving them such generic names as TRUE and FALSE.

Update: I’m not certain but it looks like compiz might be using Xlib internal API by including the Xregion.h header, which is not a documented header; this puts the blame mostly on compiz if correct. Essentially it seems that Xregion.h provides the implementation for the public region operations which are defined in Xutil.h (in particular, ‘struct _Xregion’ is defined in Xregion.h, but is an opaque structure in Xutil.h). See documentation for region manipulation here.

Advertisements

2 thoughts on “Compiz, X11, Glib, and general stupidity

  1. Looks to me more like newer versions of X11 and glib don’t compile with arbitrary software. It’s fairly presumptuous of them to pollute the global namespace with their macro definitions without at least checking if they’re already defined. It would not be unusual for any application to include both X11 and glib headers, so obviously this could happen at any time anywhere. The evidence points to the latest X11 headers being buggy.

    Really, if you find a bug at the developer level, report it upstream. It’s virtually impossible for maintainers to test everything against every permiutation and variation out there.

    1. I often do report bugs (this is not a “developer level” bug, it is a build failure). In this case I delayed a bit while I investigated further. Reporting a bug required me to create an “Ubuntu One” account, which is something I would rather have avoided. Also, the build problems mentioned in this blog post are not the only – and not even the first – problems I encountered while trying to build compiz. See my bug report. Let alone “test everything against every permiuatation” [sic] it looks like there was no build test in a regular environment with the latest version of each of the dependencies, which seems to me like a reasonable thing to do.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s