[cairo] Compiling for Cairo development

Bill Spitzak spitzak at gmail.com
Thu Jun 10 13:55:32 PDT 2010

On 05/24/2010 07:14 AM, Chris Wilson wrote:
> On Mon, 24 May 2010 10:10:27 +0200, Arjen Nienhuis<a.g.nienhuis at gmail.com>  wrote:
>> Hi,
>> You use this for pixman, cairo and the app that needs cairo:
>> PREFIX=$HOME/whatever
>> PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./autogen.sh --prefix=$PREFIX
> Cairo and pixman should both support uninstalled .pc, so compile pixman as
> normal and then try for cairo:
>    PKG_CONFIG_PATH=$pixmandir ./autogen.sh
> and
>    PKG_CONFIG_PATH=$pixmandir:$cairodir ./autogen.sh
> for your application.
> -ickle

This allowed both pixman and cairo to compile, but I cannot build 
applications using it and pkg-config. In my setup pixman, cairo, and my 
application are all directories at the same level, and when building the 
application I am in the applications directory.

First it appears PKG_CONFIG_TOP_BUILD_DIR is needed (though that seems 
to be a stupid pkg-config bug, they should default to '.' rather than 
producing a $(xxx) text that will not be substututed if you put 
pkg-config inside `` in a shell.

But then:

PKG_CONFIG_TOP_BUILD_DIR=. PKG_CONFIG_PATH=../cairo:../pixman pkg-config 
--cflags --libs pangocairo

-pthread -I./../cairo/./src -I./../pixman/pixman 
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 
-I/usr/include/libpng12  ./../cairo/src/libcairo.la -pthread 
-lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 
-lrt -lglib-2.0

This result specifies a file called libcairo.la. The gcc compiler does 
not like that file (it is a "libtool library file").

Patching the file cairo-uninstalled.pc to specify the 
.libs/libcairo.so.2 instead of libcairo.la fixes this but I am not sure 
if that is the solution. I still need to set LD_LIBRARY_PATH to use it, 
I would prefer a solution that forces the full path name into the 
compiled program, and/or makes a .a file be used instead of a .so.

More information about the cairo mailing list