[cairo] Bug in freetype2 pkg-config requirement

Igor Foox ifoox at redhat.com
Mon Aug 29 08:52:20 PDT 2005


On Mon, 2005-08-29 at 10:37 -0400, Owen Taylor wrote:
> On Mon, 2005-08-29 at 10:06 -0400, Igor Foox wrote:
> > On Sun, 2005-08-28 at 10:55 -0400, Owen Taylor wrote:
> > > On Fri, 2005-08-26 at 19:32 -0400, Igor Foox wrote:
> > > > Hi there,
> > > > 
> > > > I've built cairo-1.0.0, and then tried to build gtk-2.8.0 on top of it.
> > > > In the process I discovered what looks like a bug in the cairo.pc.in
> > > > file. The way it is now, the freetype2 CFLAGS dependency does not get
> > > > generated. I've attached a fix that I made locally to address the
> > > > problem.
> > > 
> > > Can you be more specific about the problem you ran into building GTK+?
> > 
> > Actually the problem was with pango. Unfortunately I don't have the
> > error trace available. But essentially the build couldn't find
> > ft2build.h, which was needed by the cairo backend. However since cairo
> > didn't indicate that it's CFlags depended on freetype2 then some gcc
> > line in the pango make file didn't have the appropriate -I for freefont.
> 
> Without more information, there's not much I can do.
> 
> Pango has checks to find the cflags for FreeType; it's hard to guess
> what's not working for you.

Hi Owen,

I've reproduced the problem. What seems to happen is that pango doesn't
depend on FreeType directly, it depends on it through Cairo and through
FontConfig (I think). Pango builds and installs. However when I try to
build GTK+ (2.8.0) I get [1]. You can see that I'm installing the GTK+
stack into a non-standard location (/opt) but I don't think that should
impact the build. 

What I think is happening is that cairo.pc does not contain a reference
to FreeType2 in the CFLAGS even though it depends on it, Pango doesn't
depend on FreeType directly, neither does GTK+. So in some compile lines
for GTK+ -I/opt/include/freetype2 is missing, and I get the error.

Like I mentioned versions <= 0.9.3 of cairo did include FreeType in
cairo.pc. Here's the difference between cairo.pc.in 0.9.3 and 1.0.0

--- cairo.pc.in 17 Aug 2005 22:57:45 -0000      1.22
+++ cairo.pc.in 26 Aug 2005 23:27:14 -0000
@@ -8,5 +8,5 @@
 Version: @VERSION@
 
 @PKGCONFIG_REQUIRES@: @FREETYPE_REQUIRES@ @XRENDER_REQUIRES@
@PNG_REQUIRES@ @GLITZ_REQUIRES@
-Libs: @FREETYPE_CONFIG_LIBS@ -L${libdir} -lcairo 
-Cflags: @FREETYPE_CONFIG_CFLAGS@ -I${includedir}/cairo
+Libs: @FREETYPE_LIBS@ -L${libdir} -lcairo 
+Cflags: @FREETYPE_CFLAGS@ -I${includedir}/cairo

I'm not sure what the difference is between @FREETYPE_CONFIG_LIBS@ and
@FREETYPE_CFLAGS@, but here's what it causes in the .pc:

1.0.0:
Requires.private: freetype2 >= 8.0.2 fontconfig xrender libpng12
Libs:  -L${libdir} -lcairo
Cflags:  -I${includedir}/cairo

0.9.3:
Requires.private: freetype2 >= 8.0.2 fontconfig xrender libpng12
Libs: -lfreetype -lz   -L${libdir} -lcairo
Cflags: -I/usr/include/freetype2   -I${includedir}/cairo


Thanks,
Igor

---------------------------------------
[1]:

 gcc -DHAVE_CONFIG_H -I. -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\"
-DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_DEPRECATED
-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED
-DG_DISABLE_CAST_CHECKS -pthread -DXTHREADS -D_REENTRANT
-DXUSE_MTSAFE_API -I/opt/include/glib-2.0 -I/opt/lib/glib-2.0/include
-I/opt/include/pango-1.0 -I/opt/include/cairo -I/usr/X11R6/include
-I/usr/X11R6/include -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -Wall -MT
gdkdrawable-x11.lo -MD -MP -MF .deps/gdkdrawable-x11.Tpo -c
gdkdrawable-x11.c  -fPIC -DPIC -o .libs/gdkdrawable-x11.o
In file included from /opt/include/pango-1.0/pango/pangofc-font.h:25,
                 from /opt/include/pango-1.0/pango/pango-ot.h:25,
                 from /opt/include/pango-1.0/pango/pangoxft.h:27,
                 from gdkdrawable-x11.c:32:
/usr/include/ft2build.h:56:38: error: freetype/config/ftheader.h: No
such file or directory
In file included from /opt/include/pango-1.0/pango/pango-ot.h:25,
                 from /opt/include/pango-1.0/pango/pangoxft.h:27,
                 from gdkdrawable-x11.c:32:
/opt/include/pango-1.0/pango/pangofc-font.h:26:10: error: #include
expects "FILENAME" or <FILENAME>
In file included from /opt/include/pango-1.0/pango/pango-ot.h:25,
                 from /opt/include/pango-1.0/pango/pangoxft.h:27,
                 from gdkdrawable-x11.c:32:
/opt/include/pango-1.0/pango/pangofc-font.h:144: error: syntax error
before 'pango_fc_font_lock_face'
/opt/include/pango-1.0/pango/pangofc-font.h:144: warning: type defaults
to 'int' in declaration of 'pango_fc_font_lock_face'
/opt/include/pango-1.0/pango/pangofc-font.h:144: warning: data
definition has no type or storage class
In file included from /opt/include/pango-1.0/pango/pangoxft-render.h:32,
                 from /opt/include/pango-1.0/pango/pangoxft.h:30,
                 from gdkdrawable-x11.c:32:
/usr/X11R6/include/X11/Xft/Xft.h:41:10: error: #include expects
"FILENAME" or <FILENAME>
In file included from /opt/include/pango-1.0/pango/pangoxft-render.h:32,
                 from /opt/include/pango-1.0/pango/pangoxft.h:30,
                 from gdkdrawable-x11.c:32:




More information about the cairo mailing list