[cairo] Cairo 1.6.4 build failing on AIX 52

Carl Worth cworth at cworth.org
Wed Jun 18 07:45:55 PDT 2008


On Wed, 18 Jun 2008 05:19:59 -0400, Behdad Esfahbod wrote:
> On Wed, 2008-06-18 at 14:12 +0530, Ashish Yadav wrote:
> >
> > What change I need to get this fixed?

Hi Ashish,

> I'd say, get a real ANSI C compiler.

Behdad, can you elaborate a bit on this? Specifically, can you point
out what ANSI feature our code is relying on that Ashish's compiler
doesn't appear to support?

Ashish, you could start using gcc, for example, and we know that it
will compile cairo's code correctly. But we really don't intend to
limit cairo's portability to only systems using gcc.

Taking the first error:

> > While trying to compile Cairo 1.6.4 I get following errors:
> >
> > "cairo-xlib-surface.c", line 135.12: 1506-068 (S) Operation between types
> > "struct {...}*" and "int" is not allowed.

It's not obvious what the compiler is complaining about. The code of
interest looks like this:

	static XRenderPictFormat *
	_CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
	{
	    int pict_format;
	    ...
	    return XRenderFindStandardFormat (dpy, pict_format);
	}

Where XRenderFindStandardFormat should be declared, (for example, in
/usr/include/X11/extensions/Xrender.h or so), with the following
prototype:

	XRenderPictFormat *
	XRenderFindStandardFormat (Display              *dpy,
	                           int                  format);

My first guess was that the compiler isn't seeing the prototype for
XRenderFindStandardFormat, assuming it has a return-type of int,
(supporting that old K&R style with non prototype), and then
complaining.

Oh, but here's perhaps a more likely scenario. Is this on a system
without a system-installed Xrender library? If so, then the definition
of XRenderFindStandardFormat will instead be the macro inside
cairo-xlib-xrender-private.h. And that appears to have some magic
going on in it.

If that's the case, then you should be able to workaround the problem
by simply installing the Xrender library.

And Behdad, can you help justify the magic going on in
cairo-xlib-xrender-private.h? I just tweaked my cairo-features.h to
disable CAIRO_HAS_XLIB_XRENDER_SURFACE and when compiling
cairo-xlib-surface.c I got lots of warnings from gcc. Here's a
sampling of them:

cairo-xlib-xrender-private.h:66: warning: function declaration isn't a prototype
cairo-xlib-xrender-private.h: In function 'CONSUME2':
cairo-xlib-xrender-private.h:66: warning: old-style function definition
...
cairo-xlib-surface.c: In function '_CAIRO_FORMAT_TO_XRENDER_FORMAT':
cairo-xlib-surface.c:135: warning: left-hand operand of comma expression has no effect
cairo-xlib-surface.c:135: warning: pointer of type 'void *' used in
arithmetic
...

The bunch of "statement with no effect" and "value computed is not
used" are likely not much of a problem, (though I really would prefer
to be offering people compilation without such a long string of
warnings).

But "pointer of type 'void *' used in arithmetic" looks really bad to
me. Isn't that something that a compiler could make an error? (I'm not
looking up what any specifications might have to say on the matter
now---but it seems like a nasty thing for us to be doing.)

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080618/62864fd9/attachment.pgp 


More information about the cairo mailing list