Bug 4815

Summary: src/cairo.h needs <X11/Xlib.h> included on Solaris 9
Product: cairo Reporter: dave irkby <david.kirkby>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high    
Version: 1.0.0   
Hardware: SPARC   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:

Description dave irkby 2005-10-19 16:17:04 UTC
Hope you don't mind, but here is another problem, I found on Solaris 9 on SPARC.

I'm not the only one to have problems compiling cairo 1.0.0 on Solaris - see

http://lists.freedesktop.org/archives/cairo/2004-August/001734.html

The person who wrote that told me how he got around the problem. It was
necessary to add 

#include <X11/Xlib.h>

at the top of src/cairo.h

If one looks at the file /usr/include/X11/Xutil.h on Solaris, it clearly states
<X11/Xlib.h> must be included. 

sparrow / # grep "You must" /usr/include/X11/Xutil.h
/* You must include <X11/Xlib.h> before including this file */

If you write a "hello world" program, but include <X11/Xutil.h> without
<X11/Xlib.h> and it will fail to compile. Add in <X11/Xlib.h> before the
<X11/Xutil.h> and it will compile. 

I've tried hacking taking this onto cairo 1.0.2 and it did not work, although I
have not spent much time on it. Perhaps it needs to go into another file, in
additon (or instead of) src/cairo.h
Comment 1 Carl Worth 2005-10-19 16:31:30 UTC
Cairo does not directly include X11/Xutil.h, but instead includes
X11/extensions/Xrender.h. So there may be some interest at getting that header
file fixed to be sulf-sufficient, (though that would be a bug outside of cairo's
control).

We definitely don't want to put an include X11/Xlib.h into cairo.h.

Can you check if putting this extra include into cairo-xlib-xrender.h just
before the include of X11/extensions/Xrender.h fixes the problem?

Thanks,

-Carl
Comment 2 dave irkby 2005-10-20 16:28:44 UTC
(In reply to comment #1)
> Cairo does not directly include X11/Xutil.h, but instead includes
> X11/extensions/Xrender.h. So there may be some interest at getting that header
> file fixed to be sulf-sufficient, (though that would be a bug outside of cairo's
> control).
> 
> We definitely don't want to put an include X11/Xlib.h into cairo.h.
> 
> Can you check if putting this extra include into cairo-xlib-xrender.h just
> before the include of X11/extensions/Xrender.h fixes the problem?
> 
> Thanks,
> 
> -Carl
> 

Hi Carl,
I did what you asked and added the line:

#include <X11/Xlib.h>

to 

cairo-xlib-xrender.h just before the include of X11/extensions/Xrender.h. I then
configureed as with: LDFLAGS="-mimpure-text"

The configure script worked fine, and the compilation went fine except for one
warning:

sparrow /tmp/cairo-1.0.0 % gmake > /dev/null
cairo-output-stream.c: In function `dtostr':
cairo-output-stream.c:143: warning: subscript has type `char'

So the addition suggested seems to have cured the complication problem on 1.0.0. 

I tried the same on 1.0.2 too, and again the compilation problem has gone OK
(except for that warning), so your fix has solved that problem. 

There are still a large number of test failures though - 46 failures on 1.0.0
(see below). Some are due to "Fontconfig error: Cannot load default config file"
so that is an issue I need to resolve, but plenty don't give any such error
message, but still fail. I did however raise the issue of test failures on bugid
4812 ("51 of 56 tests failed on Solaris build of 1.0.0"). Now the number of
failures seems to have fallen from 51 to 47. Not sure if that is a result of
placing the include in cairo-xlib-xrender.h rather than cairo.h, or something
else. But I still have a lot of failures. 

One thing I spotted on the comp.unix.solaris 

http://groups.google.co.uk/group/comp.unix.solaris/tree/browse_frm/thread/77676cb71c998a78/cfd74a77e0407016?rnum=1&hl=en&q=Xrender+missing%2Fnot+compiling+-%3E+gtk+problems&_done=%2Fgroup%2Fcomp.unix.solaris%2Fbrowse_frm%2Fthread%2F77676cb71c998a78%2Fcfd74a77e0407016%3Flnk%3Dst%26q%3DXrender+missing%2Fnot+compiling+-%3E+gtk+problems%26rnum%3D1%26hl%3Den%26#doc_ccb06a2493357cad

is recognision of a Solaris bug, with Xrender.h including X11/Xutil.h without
including X11/Xlib.h first. I'm not sure if that is relavant here (I don't think
so), but apparently that was fixed in Solaris 10, but the poster making that
post (who works for Sun) said there is no patch for Solaris 9, which I am running.

I hope that is helpful,

Dave Kirkby


/tmp/cairo-1.0.0 % gmake check
<snip>
creating xlib-surface
gmake[2]: Leaving directory `/tmp/cairo-1.0.0/test'
gmake  check-TESTS
gmake[2]: Entering directory `/tmp/cairo-1.0.0/test'

a8-mask is expected to fail:
        image backend fails because libpixman only handles (stride %
sizeof(pixman_bits) == 0)
ELFELFa8-mask-image:  XFAIL
ELFELFa8-mask-xlib:   XFAIL
XFAIL: a8-mask

ELFELFcaps-sub-paths-image:   FAIL
ELFELFcaps-sub-paths-xlib:    FAIL
FAIL: caps-sub-paths

ELFELFclip-nesting-image:     FAIL
ELFELFclip-nesting-xlib:      FAIL
FAIL: clip-nesting

Fontconfig error: Cannot load default config file
clip-operator-image:    FAIL
clip-operator-xlib:     FAIL
FAIL: clip-operator

ELFELFclip-twice-image:       FAIL
ELFELFclip-twice-xlib:        FAIL
FAIL: clip-twice

ELFELFcomposite-integer-translate-source-image:       FAIL
ELFELFcomposite-integer-translate-source-xlib:        FAIL
FAIL: composite-integer-translate-source

ELFELFcomposite-integer-translate-over-image: FAIL
ELFELFcomposite-integer-translate-over-xlib:  FAIL
FAIL: composite-integer-translate-over

ELFELFcomposite-integer-translate-over-repeat-image:  FAIL
ELFELFcomposite-integer-translate-over-repeat-xlib:   FAIL
FAIL: composite-integer-translate-over-repeat

ELFcreate-from-png-image:      FAIL
ELFcreate-from-png-xlib:       FAIL
FAIL: create-from-png

ELFcreate-from-png-image:      FAIL
ELFcreate-from-png-xlib:       FAIL
FAIL: create-from-png-stream

ELFELFdash-offset-negative-image:     FAIL
ELFELFdash-offset-negative-xlib:      FAIL
FAIL: dash-offset-negative

ELFELFfill-and-stroke-image:  FAIL
ELFELFfill-and-stroke-xlib:   FAIL
FAIL: fill-and-stroke

ELFELFfill-rule-image:        FAIL
ELFELFfill-rule-xlib: FAIL
FAIL: fill-rule

filter-nearest-offset is expected to fail:
        wrong sampling location for nearest-neighbor filter in libpixman and Render
ELFELFfilter-nearest-offset-image:    XFAIL
ELFELFfilter-nearest-offset-xlib:     XFAIL
XFAIL: filter-nearest-offset

get-and-set-image:      FAIL
get-and-set-xlib:       FAIL
FAIL: get-and-set

ELFELFgradient-alpha-image:   FAIL
ELFELFgradient-alpha-xlib:    FAIL
FAIL: gradient-alpha

ELFELFleaky-polygon-image:    FAIL
ELFELFleaky-polygon-xlib:     FAIL
FAIL: leaky-polygon

ELFELFline-width-image:       FAIL
ELFELFline-width-xlib:        FAIL
FAIL: line-width

ELFELFlinear-gradient-image:  FAIL
ELFELFlinear-gradient-xlib:   FAIL
FAIL: linear-gradient

ELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFmask-image:
    FAIL
ELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFmask-xlib:
     FAIL
FAIL: mask

ELFELFmask-ctm-image: FAIL
ELFELFmask-ctm-xlib:  FAIL
FAIL: mask-ctm

ELFELFmask-surface-ctm-image: FAIL
ELFELFmask-surface-ctm-xlib:  FAIL
FAIL: mask-surface-ctm

ELFELFmove-to-show-surface-image:     FAIL
ELFELFmove-to-show-surface-xlib:      FAIL
FAIL: move-to-show-surface

ELFELFnil-surface-image:      FAIL
ELFELFnil-surface-xlib:       FAIL
FAIL: nil-surface

Fontconfig error: Cannot load default config file
operator-clear-image:   FAIL
operator-clear-xlib:    FAIL
FAIL: operator-clear

Fontconfig error: Cannot load default config file
operator-source-image:  FAIL
operator-source-xlib:   FAIL
FAIL: operator-source

ELFELFpaint-image:    FAIL
ELFELFpaint-xlib:     FAIL
FAIL: paint

ELFELFpaint-with-alpha-image: FAIL
ELFELFpaint-with-alpha-xlib:  FAIL
FAIL: paint-with-alpha

ELFELFpath-data-image:        FAIL
ELFELFpath-data-xlib: FAIL
FAIL: path-data

pixman-rotate is expected to fail:
        known off-by-one bug when rotating a pixman image
ELFELFpixman-rotate-image:    XFAIL
ELFELFpixman-rotate-xlib:     XFAIL
XFAIL: pixman-rotate

ELFELFrectangle-rounding-error-image: FAIL
ELFELFrectangle-rounding-error-xlib:  FAIL
FAIL: rectangle-rounding-error

ELFELFscale-source-surface-paint-image:       FAIL
ELFELFscale-source-surface-paint-xlib:        FAIL
FAIL: scale-source-surface-paint

select-font-no-show-text-image: PASS
select-font-no-show-text-xlib:  PASS
PASS: select-font-no-show-text

ELFELFself-copy-image:        FAIL
ELFELFself-copy-xlib: FAIL
FAIL: self-copy

self-intersecting is expected to fail:
        Self-intersecting strokes are wrong due to incremental trapezoidization.
ELFELFself-intersecting-image:        XFAIL
ELFELFself-intersecting-xlib: XFAIL
XFAIL: self-intersecting

ELFELFset-source-image:       FAIL
ELFELFset-source-xlib:        FAIL
FAIL: set-source

Fontconfig error: Cannot load default config file
show-text-current-point-image:  FAIL
show-text-current-point-xlib:   FAIL
FAIL: show-text-current-point

ELFELFsource-clip-image:      FAIL
ELFELFsource-clip-xlib:       FAIL
FAIL: source-clip

ELFELFsource-surface-scale-paint-image:       FAIL
ELFELFsource-surface-scale-paint-xlib:        FAIL
FAIL: source-surface-scale-paint

surface-finish-twice-image:     PASS
surface-finish-twice-xlib:      PASS
PASS: surface-finish-twice

ELFELFsurface-pattern-image:  FAIL
ELFELFsurface-pattern-xlib:   FAIL
FAIL: surface-pattern

Fontconfig error: Cannot load default config file
text-antialias-gray-image:      FAIL
text-antialias-gray-xlib:       FAIL
FAIL: text-antialias-gray

Fontconfig error: Cannot load default config file
text-antialias-none-image:      FAIL
text-antialias-none-xlib:       FAIL
FAIL: text-antialias-none

Fontconfig error: Cannot load default config file
text-antialias-subpixel-image:  FAIL
text-antialias-subpixel-xlib:   FAIL
FAIL: text-antialias-subpixel

Fontconfig error: Cannot load default config file
text-cache-crash-image: FAIL
text-cache-crash-xlib:  FAIL
FAIL: text-cache-crash

Fontconfig error: Cannot load default config file
text-pattern-image:     FAIL
text-pattern-xlib:      FAIL
FAIL: text-pattern

text-rotate is expected to fail:
        minor bugs in positioning rotated glyphs
Fontconfig error: Cannot load default config file
text-rotate-image:      XFAIL
text-rotate-xlib:       XFAIL
XFAIL: text-rotate

ELFELFtransforms-image:       FAIL
ELFELFtransforms-xlib:        FAIL
FAIL: transforms

ELFELFtranslate-show-surface-image:   FAIL
ELFELFtranslate-show-surface-xlib:    FAIL
FAIL: translate-show-surface

ELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFtrap-clip-image:
 FAIL
ELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFELFtrap-clip-xlib:
FAIL
FAIL: trap-clip

ELFELFunantialiased-shapes-image:     FAIL
ELFELFunantialiased-shapes-xlib:      FAIL
FAIL: unantialiased-shapes

Fontconfig error: Cannot load default config file
unbounded-operator-image:       FAIL
unbounded-operator-xlib:        FAIL
FAIL: unbounded-operator
PASS: user-data

ELFELFrel-path-image: FAIL
ELFELFrel-path-xlib:  FAIL
FAIL: rel-path

Fontconfig error: Cannot load default config file
FAIL: ft-font-create-for-ft-face

PASS: xlib-surface
========================================================================
47 of 56 tests failed
Please report to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo
========================================================================
gmake[2]: *** [check-TESTS] Error 1
gmake[2]: Leaving directory `/tmp/cairo-1.0.0/test'
gmake[1]: *** [check-am] Error 2
gmake[1]: Leaving directory `/tmp/cairo-1.0.0/test'
gmake: *** [check-recursive] Error 1




Comment 3 dave irkby 2005-10-20 16:42:01 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Cairo does not directly include X11/Xutil.h, but instead includes
> > X11/extensions/Xrender.h. So there may be some interest at getting that header
> > file fixed to be sulf-sufficient, (though that would be a bug outside of cairo's
> > control).

Sorry, I forgot you said that. 


> One thing I spotted on the comp.unix.solaris 
> 
>
http://groups.google.co.uk/group/comp.unix.solaris/tree/browse_frm/thread/77676cb71c998a78/cfd74a77e0407016?rnum=1&hl=en&q=Xrender+missing%2Fnot+compiling+-%3E+gtk+problems&_done=%2Fgroup%2Fcomp.unix.solaris%2Fbrowse_frm%2Fthread%2F77676cb71c998a78%2Fcfd74a77e0407016%3Flnk%3Dst%26q%3DXrender+missing%2Fnot+compiling+-%3E+gtk+problems%26rnum%3D1%26hl%3Den%26#doc_ccb06a2493357cad
> 
> is recognision of a Solaris bug, with Xrender.h including X11/Xutil.h without
> including X11/Xlib.h first. 

That probably indicates the bug is in Xrender, not Cairo. Still, a
README.solaris, highligting the issue, and the one about the odd the odd flag
-mimpure-text needed on gcc, might be useful. It will save us Solaris users a
bit of a headache. 

Dave K
Comment 4 Johannes Abt 2006-08-24 07:01:34 UTC
For the records:
I have got the same problem with HP-UX 11.00,
i.e. Xutil.h requires Xlib.h, but no file feels responsible for including it.

A part of the dependency tree of cairo-test.c:

    /soft/gtk/gtk2/gtk+-2.10/cairo-1.2.2/cairo-1.2.2/src/cairo-xlib-xrender.h
        /soft/gtk/gtk2/gtk+-2.10/cairo-1.2.2/cairo-1.2.2/src/cairo.h
        /usr/local/scxext/include/X11/extensions/Xrender.h
            /usr/local/scxext/include/X11/extensions/render.h
            /usr/include/X11/Xfuncproto.h
            /usr/include/X11/Xosdefs.h
            /usr/include/X11/Xutil.h

It compiles to:
cc: "/usr/include/X11/Xutil.h", line 116: error 1000: Unexpected symbol: "Bool".
[...]
Comment 5 Chris Wilson 2008-10-10 13:37:18 UTC
It appears cairo-xlib-xrender.h has surrendered and now includes <X11/Xlib.h>.

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.