Compiz 0.9 and GCC 4.5

Hi everyone,

It appears that several uses of git master and distributions with GCC/G++ 4.5, such as openSUSE 11.3 and Arch Linux are experiencing random crashes when loading or unloading plugins. We think(*) this is a bug in GCC/G++ and I am currently drafting a testcase to confirm this and also a workaround for the bug. At the moment, in order to avoid this crash, you will need to use an older version of GCC/G++, such as GCC 4.4.3. For Arch Linux you can get this from the AUR with “yaourt gcc4”, selection 6, and I would imagine a package is available for openSUSE. When compiling, press ‘t’ in ccmake to get advanced options and change the compiler executable paths to your older compiler.

Technical Details of what we think the bug is:
We use a static variable within a template class in order to reference count it, so whenever a new class of some template is instantiated, the reference count increases (since the variable is static and is effectively global, only accessed with the operator of scope (::)). However, when new plugins are opened using ltdl, the constructor for this static variable can be called again, and so the reference count will decrease to zero. This creates a dangerous situation where  if any more of those classes go away, then core will think all of them are gone and start removing bits necessary to make those classes work. I shall post a testcase in this bug as soon as it is ready.


17 thoughts on “Compiz 0.9 and GCC 4.5

  1. Sounds like dodgy linking to me. If more than one plugin attempts to instantiate the same static variable, surely you end up with multiple copies of the variable at run-time, rather than every plugin referring to the same thing? Even if you’re loading with rtld_global, static symbols aren’t exported, so I don’t see how the plugins ever end up referring to the same reference count…

    I’ve never looked at the compiz code in any detail, but assuming there’s some common library which all plugins link against, instantiate the reference count in that library (which will only be loaded once, no matter how many plugins are loaded) and export functions from that library to manipulate it. That’s how I would solve it, anyway.

    1. For the record the code in question can be found in git core/include/pluginclasses.h and pluginclasshandler.h

    1. Not very many actually. In fact this is pretty much the last one. Of course, in testing you can find bugs you didn’t expect all the time.

  2. I think I stumbled over some kind of bug:

    for the love of compiz I can’t get it to compile with gtk-window-decorator enabled – it just spills out an error and says:

    “FindCompiz.cmake” file not found in cmake module directories.
    It should be installed to allow building of external compiz packages.
    Call “sudo make findcompiz_install” to install it.

    I’m sure I’m not the only one (I’ve read several other reports with the same error message):

    1. I need the full output to see why, you are probably missing the dependencies needed to compile it.

      That message just means you need to run that command if you want to compile external plugins.

      1. I’m sure there soon will be updated ebuilds for the unstable release (I’m using Gentoo)

        currently work unfortunately doesn’t allow me to tinker much with the computer

        thanks !

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s