[GRASS-dev] GRASS 7: cairo compilation problem

Glynn Clements glynn at gclements.plus.com
Fri Aug 27 13:47:53 EDT 2010


Markus Neteler wrote:

> I have problems to compile cairo after a distro upgrade:

You did run "make distclean" then re-configure, right?

> [neteler at north cairodriver]$ make
> gcc -shared -o /home/neteler/grass70/dist.x86_64-unknown-linux-gnu/lib/libgrass_cairodriver.7.0.svn.so
> -L/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/lib
> -L/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/lib
> -Wl,--no-undefined -Wl,--export-dynamic  -L/usr/lib64
> -Wl,-rpath-link,/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/lib

> -lgrass_driver.7.0.svn
> -lgrass_gis.7.0.svn -lfreetype -lXrender -lcairo -lX11
> -L/usr/lib64 -lSM -lICE -lX11  -lm
> OBJ.x86_64-unknown-linux-gnu/Text.o: In function `fc_init':
> /home/neteler/grass70/lib/cairodriver/Text.c:180: undefined reference
> to `FcInit'

Fc = Fontconfig.

> In Text.c, I see
> 
> #if CAIRO_HAS_FT_FONT
> #include <cairo-ft.h>
> #include <fontconfig/fontconfig.h>
> #endif
> 
> but
> 
> [neteler at north cairodriver]$ grep CAIRO_HAS_FT_FONT ../../include/config.h
> [neteler at north cairodriver]$ grep CAIRO_HAS_FT_FONT *
> Text.c:#if CAIRO_HAS_FT_FONT
> Text.c:#if CAIRO_HAS_FT_FONT
> Text.c:#if CAIRO_HAS_FT_FONT
> Text.c:#if CAIRO_HAS_FT_FONT
> Text.c:#if CAIRO_HAS_FT_FONT
> 
> and
> 
> ls -l /usr/include/fontconfig/fontconfig.h
> -rw-r--r-- 1 root root 23426 2010-01-18 17:58
> /usr/include/fontconfig/fontconfig.h
> 
> So I wonder how this should work but I may have overseen a detail.

If cairo was built with Fontconfig support, CAIRO_HAS_FT_FONT will be
defined in cairo-features.h. Also, "pkg-config --libs cairo-ft" will
typically output something like "-lcairo -lfreetype -lfontconfig".

The fact that -lfontconfig isn't appearing in the link command
suggests that "pkg-config --libs cairo-ft" isn't mentioning it. But
the undefined symbol errors suggest that CAIRO_HAS_FT_FONT is defined
in cairo-features.h.

IOW, cairo can't make up its mind whether it was built with fontconfig
support or not. Is it possible that you have more than one version,
and it's using the headers from one version and libraries (and
pkg-config data) from another.

Either that, or configure hasn't been re-run and Platform.make still
has the old linker flags for a non-fontconfig version of cairo.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list