[GRASS-dev] GRASS 7: cairo compilation problem

Markus Neteler neteler at osgeo.org
Sat Aug 28 07:01:16 EDT 2010


On Fri, Aug 27, 2010 at 7:47 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Markus Neteler wrote:
>
>> I have problems to compile cairo after a distro upgrade:
>
> You did run "make distclean" then re-configure, right?

Yes.

>> [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.

Yes:

grep FT /usr/include/cairo/cairo-features.h
#define CAIRO_HAS_FT_FONT 1

> Also, "pkg-config --libs cairo-ft" will
> typically output something like "-lcairo -lfreetype -lfontconfig".

I only get

pkg-config --libs cairo-ft
-lcairo -lfreetype

> 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.

So some mess here.

> 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.

rpm -qa | grep 'cairo\|fontconf' | sort
fontconfig-2.8.0-2mdv2010.1
lib64cairo2-1.9.6-3mdv2010.1
lib64cairo-devel-1.9.6-3mdv2010.1
lib64cairomm1.0_1-1.8.4-1mdv2010.1
lib64fontconfig1-2.8.0-2mdv2010.1
lib64fontconfig-devel-2.8.0-2mdv2010.1
libcairo2-1.9.6-3mdv2010.1
libfontconfig1-2.8.0-2mdv2010.1
python-cairo-1.8.8-1mdv2010.1

This looks normal.

ldd /usr/lib64/libcairo.so | grep font
        libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007f41a3f36000)

If I add -lfontconfig in include/Make/Platform.make here:

#cairo
CAIROINC                  = -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12
CAIROLIB                  = -lfreetype -lXrender -lcairo -lX11 -lfontconfig
USE_CAIRO                 = 1
CAIRO_HAS_XRENDER         = 1
CAIRO_HAS_XRENDER_SURFACE = 1

then it compiles ok.

As I understand, the pkg-config output here is wrong since it is used:
configure.in:CAIROLIB=`pkg-config --libs $cairo`

Markus


More information about the grass-dev mailing list