Bug 7424

Summary: --disable-xlib-xrender not working
Product: cairo Reporter: Behdad Esfahbod <freedesktop>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high CC: nikke, ostroffjh
Version: 1.2.0   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Fixup ./configure --disable-xlib-xrender

Description Behdad Esfahbod 2006-07-04 19:04:43 UTC
Currently --disable-xlib-xrender only causes the cflags/libs for xrender to not
be included.  This makes the code not build, not surprisingly.  We need to
#if/endif out the xrender stuff in cairo-xlib-*.c, to allow building without
xrender.  Donno how hard that change is.
Comment 1 Peter Marquardt 2006-09-12 06:18:44 UTC
(In reply to comment #0)
> Currently --disable-xlib-xrender only causes the cflags/libs for xrender to not
> be included.

Side-effect number 2:

Calls to XRender*-functions are bound into the libs, so when the next
application tries to ./configure against cairo (ex. pango) configure fails. Not
because cairo ain't installed, but because Xrender-functions don't link.
---------------- rrrrrrrrrrrrrrrrrrip --------------
config log of pango looks like this:
configure:21412: checking for CAIRO
configure:21420: $PKG_CONFIG --exists --print-errors "cairo >= 1.2.2"
configure:21423: $? = 0
configure:21438: $PKG_CONFIG --exists --print-errors "cairo >= 1.2.2"
configure:21441: $? = 0
configure:21475: result: yes
configure:21487: checking for cairo_surface_write_to_png in -lcairo
configure:21517: gcc -o conftest -g -O2 -Wall   -L/package/gpe/lib -lcairo  
conftest.c -lcairo   >&5
/package/gpe/lib/libcairo.so: undefined reference to `XRenderQueryExtension'
/package/gpe/lib/libcairo.so: undefined reference to `XRenderFreePicture'
[...]
collect2: ld returned 1 exit status
configure:21523: $? = 1
configure: failed program was:
| /* confdefs.h.  */
[...]
---------------- rrrrrrrrrrrrrrrrrrip --------------

probably out-deffing will help as suggested.

cheers,
     Peter
Comment 2 Niklas Edmundsson 2007-07-05 01:16:25 UTC
I'm getting bitten by this when trying to compile cairo (both 1.2.x and 1.4.x) on AIX 5.3 which doesn't have Xrender.

configure correctly understands the situation:
  Xlib:          yes
  Xlib Xrender:  no (requires Xrender http://freedesktop.org/Software/xlibs)

However, the build fails on cairo-xlib-surface.c. It includes cairo-xlib-xrender.h which tries to include Xrender.h, which of course fails.

It would be nice if the code could be fixed to follow what configure says. From what I have gathered the thing should work without Xrender, it's just that the code always gets compiled in... I'm rather unclued on what needs changing though, so I've been unable to whip up a patch for it.

At the very least, fix configure to disable the xlib-stuff altogether if it doesn't find xrender, if that's the recommended workaround.
Comment 3 Jack 2007-08-14 14:26:59 UTC
This is still present with cairo 1.4.10 on Solaris 8 (there is no X11/extensions/Xrender.h).  It does compile with --disable-xlib.  Just using --disable-xlib-xrender behaves as described here.  
Comment 4 Behdad Esfahbod 2007-09-04 18:28:21 UTC
Fixed now in git master.  Should go in 1.6
Comment 5 Chris Wilson 2008-01-14 10:13:42 UTC
Created attachment 13712 [details] [review]
Fixup ./configure --disable-xlib-xrender

Hmm, make check is failing with ./configure --disable-xlib-xrender (cairo_xlib_surface_create_with_xrender_format() still remains in the public API and the boilerplate code needs fixup as well).

Most of the patch resolves around removing the indirect «#include "cairoint.h"» from the boilerplate code, I think the most contentious chunk is the change in the public API (cairo-xlib-xrender.h) to use CAIRO_HAS_XLIB_XRENDER_SURFACE instead of CAIRO_HAS_XLIB_SURFACE.
Comment 6 Behdad Esfahbod 2008-01-14 13:19:31 UTC
Looks good.  Please push Chris.

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.