[ubuntu-uk] Colorzilla GCC-4 incompatibility (was: eyedropper replacement)

Paul Sladen ubuntu at paul.sladen.org
Sun Feb 11 12:51:52 GMT 2007

On Sun, 11 Feb 2007, Alex Sirota wrote:

Hello Alex,

Thanks for responding!  BTW: The webpage for ColorZilla appears to have
disappeared and been replaced with your homepage (uploaded to the wrong
directory maybe?):


> I'm still investigating why exactly this happens - if anyone can shed some
> more light on this

There's a couple of pointers in the previous email and a couple more
references on the following page (search for "C++", ColorZilla gets a
mention specifically as example of an extension contain binary components):


Googling for some combinations of the following keywords:

  Mozilla extensions C++ ABI GCC-3 GCC-4 XPCOM

also brings up the right sort results.  It's to do with a change in the
format of compiled C++ binaries (the "ABI") between the old version of GCC
that Mozilla still use and the new version of GCC that more up-to-date
distributions are using.

As a new version of each Linux distribution comes out, you'll gradually see
the "problem" extend to more and more distributions.

> > would it be possible to move the GetPixel() function to plain C
> I believe that the problem goes beyond a simple recompile on Ubuntu.

The recompile with GCC-4 should solve the immediate problem on Ubuntu/
Fedora.  However then there would be two libraries---one for older GCC-3
installs (also the offical builds) and one for newer GCC-4 based distros.

At this point it would either be necessary to supply two downloads, or to
have the JavaScript in the package detect which library to load (much the
same as the current 'mac'/'intelmac' choice of library).

One possibility might be to attempt to load the library and if fails,
attempt to load the other GCC-4 one using a try/except clause.

> The binary component is a C++ XPCOM classs that Mozilla communicates with.
> This means that it cannot be implemented in plain C

Ultimately, everything that can be done in C++ can be done in C (originally
C++ was just a pre-processor that converted C++ into C source);  in this
case it should be made even easier because of the XPCOM abstraction layer.

There's some documentation on the Mozilla site about having Mozilla
automatically select between directories of libraries depending on the
platform in use:


which might remove the current Javascript auto-detection code from the
extension;  unfortunately platform string "Linux_x86-gcc3" is used for both
GCC3 *and* GCC4 compiled versions...  wah.

It should be possible create the IDL description of the interface (a single
class, containing a single function) and then create a plain C file that
provides that function.

Is the reverse-engineered contents in my previous email correct---is there
anything I missed that the platform-specific library also needs to do?

Do you have the source-code to hand, that might making testing out
alternatives a little easier.

Why do one side of a triangle when you can do all three.   Southampton, GB

More information about the ubuntu-uk mailing list