Bug 84569

Summary: Quartz backend build failure (git master)
Product: cairo Reporter: ~suv <suv-sf>
Component: quartz backendAssignee: Vladimir Vukicevic <vladimir>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: Mac OS X (All)   
Whiteboard:
i915 platform: i915 features:

Description ~suv 2014-10-01 21:03:21 UTC
Recent git master fails to compile the Quartz backend (tested on OS X 10.7.5):

$ make -k
(…)
Making all in src
make  all-am
  CC       cairo-quartz-surface.lo
cairo-quartz-surface.c:2207:1: error: conflicting types for '_cairo_surface_is_quartz'
_cairo_surface_is_quartz (cairo_surface_t *surface)
^
cairo-quartz-surface.c:144:1: note: previous declaration is here
_cairo_surface_is_quartz (const cairo_surface_t *surface);
^
cairo-quartz-surface.c:2209:33: error: use of undeclared identifier 'cairo_quartz_surface_backend'
    return surface->backend == &cairo_quartz_surface_backend;
                                ^
2 errors generated.
make[3]: *** [cairo-quartz-surface.lo] Error 1
  CC       cairo-quartz-image-surface.lo
cairo-quartz-image-surface.c:382:11: error: implicit declaration of function '_cairo_surface_is_quartz' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    if (! _cairo_surface_is_quartz (surface)) {
          ^
1 error generated.
make[3]: *** [cairo-quartz-image-surface.lo] Error 1
make[3]: Target `all-am' not remade because of errors.
make[2]: *** [all] Error 2


fbb0a260b707cb5f02a14cc368c6f2f0d63564c3 compiled ok last week; the regression seems to be related to the changes in 573ddfc3d5c08c37b95a21e0a1b34acecc646053:
<http://cgit.freedesktop.org/cairo/commit/?id=573ddfc3d5c08c37b95a21e0a1b34acecc646053>
Comment 1 Andrea Canciani 2014-10-02 16:17:09 UTC
Here is a wannabe fix:
http://cgit.freedesktop.org/~ranma42/cairo/commit/?id=89d24ab1a52c052e7246d2ed5657a82364d50cd9

I will run through the testsuite just in case (it's been quite some time since I did Cairo development).
Comment 2 ~suv 2014-10-02 16:43:23 UTC
Remaining error with patch applied:

  CC       cairo-quartz-image-surface.lo
cairo-quartz-image-surface.c:382:11: error: implicit declaration of function '_cairo_surface_is_quartz' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    if (! _cairo_surface_is_quartz (surface)) {
          ^
1 error generated.
make[3]: *** [cairo-quartz-image-surface.lo] Error 1



Compiler (from Xcode 4.3.2):

$ clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Comment 3 Bryce Harrington 2014-10-02 18:37:58 UTC
Andrea, you're on the right path, that's half the fix.

For the remaining error(s) suv reported, do this:

1. _cairo_surface_is_quartz() needs to not be static, since it's used in another file.

2.  Move the declaration of _cairo_surface_is_quartz() into the cairo-quartz-private.h header.  Define it as cairo_private like other routines listed here.
Comment 4 Andrea Canciani 2014-10-03 08:06:13 UTC
(In reply to ~suv from comment #2)
> Remaining error with patch applied:
> 
>   CC       cairo-quartz-image-surface.lo
> cairo-quartz-image-surface.c:382:11: error: implicit declaration of function
> '_cairo_surface_is_quartz' is invalid in C99
>       [-Werror,-Wimplicit-function-declaration]
>     if (! _cairo_surface_is_quartz (surface)) {
>           ^
> 1 error generated.
> make[3]: *** [cairo-quartz-image-surface.lo] Error 1
> 
> 
> 
> Compiler (from Xcode 4.3.2):
> 
> $ clang --version
> Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)

Oops, I did not realize that the issue also affected quartz-image (I was building with default flags, which do not enable it).

(In reply to Bryce Harrington from comment #3)
> Andrea, you're on the right path, that's half the fix.
> 
> For the remaining error(s) suv reported, do this:
> 
> 1. _cairo_surface_is_quartz() needs to not be static, since it's used in
> another file.
> 
> 2.  Move the declaration of _cairo_surface_is_quartz() into the
> cairo-quartz-private.h header.  Define it as cairo_private like other
> routines listed here.

Did this in http://cgit.freedesktop.org/~ranma42/cairo/commit/?id=84c68269f7e24ebaf9bf02702feeb775a5bac53e

I also let it run through the testsuite and (besides from some reference images that might need to be updated) it looks mostly good (except for a couple of blend modes... will investigate those).
Comment 5 ~suv 2014-10-03 08:45:27 UTC
(In reply to Andrea Canciani from comment #4)
> Did this in http://cgit.freedesktop.org/~ranma42/cairo/commit/?id=84c68269f7e24ebaf9bf02702feeb775a5bac53e

Thx, that fixed the build. 

Remaining compiler warning (don't know how relevant it is):

  CC       cairo-quartz-image-surface.lo
cairo-quartz-image-surface.c:382:37: warning: incompatible pointer types passing 'cairo_quartz_image_surface_t *'
      (aka 'struct cairo_quartz_image_surface *') to parameter of type 'const cairo_surface_t *' (aka 'const struct _cairo_surface *')
      [-Wincompatible-pointer-types]
    if (! _cairo_surface_is_quartz (surface)) {
                                    ^~~~~~~
./cairo-quartz-private.h:87:50: note: passing argument to parameter 'surface' here
_cairo_surface_is_quartz (const cairo_surface_t *surface);
                                                 ^
1 warning generated.
Comment 6 Bryce Harrington 2014-10-03 19:12:32 UTC
I don't have a way to test quartz, but the warning looked pretty obvious so I went ahead and made a change that should fix it, and pushed all three patches.

I'll boldly assume that this bug is solved so am closing it.  If when you rebuild, you find it doesn't, then please re-open.
Comment 7 ~suv 2014-10-03 19:38:17 UTC
(In reply to Bryce Harrington from comment #6)
> I don't have a way to test quartz, but the warning looked pretty obvious so
> I went ahead and made a change that should fix it, and pushed all three
> patches.

Thx - clean build now succeeds, and the warning is gone. A quick test using the new cairo lib with inkscape trunk is ok, too.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.