[R] R Cairo Installation - Cannot find cairo.h!

Peter Langfelder peter.langfelder at gmail.com
Tue Apr 29 03:36:52 CEST 2014

Make sure you have cairo-devel installed, and remove the lines

export CAIRO_LIBS=${HOME}/usr/local/lib
export CAIRO_CFLAGS=${HOME}/usr/local/include

from your .bashrc file. If you have cairo-devel installed normally,
the headers should be found with default settings of all search paths.
The settings you have are, to the best of my somewhat limited
knowledge, wrong - you need to prefix each directory with an
appropriate compiler flags (-L for library directories, and -I for
include directories). Anyway, as I said, 1. install cairo-devel using
your package manager, and 2. remove the two lines from .bashrc.


On Mon, Apr 28, 2014 at 12:26 PM, Fong Chun Chan <fongchunchan at gmail.com> wrote:
> Hi,
> I am trying to get the R package Cairo installed. I've been successfully in
> building the latest version of Cairo library (1.12.16,
> http://cairographics.org/) from source and installed into ~/usr/local using
> ./configure --prefix=/home/fong/usr/local
> I set the my CAIRO_LIBS and CAIRO_CLAGS environment variables in my
> ~/.bashrc:
> export CAIRO_LIBS=${HOME}/usr/local/lib
> export CAIRO_CFLAGS=${HOME}/usr/local/include
> When I try to install Cairo in R using:
> install.packages('Cairo')
> I get the following error:
> checking for pkg-config... /home/fong/usr/local/bin/pkg-config
> configure: CAIRO_CFLAGS=/home/fong/usr/local/include/cairo
> checking if R was compiled with the RConn patch... no
> checking cairo.h usability... no
> checking cairo.h presence... no
> checking for cairo.h... no
> configure: error: Cannot find cairo.h! Please install cairo (
> http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
> ERROR: configuration failed for package 'Cairo'
> But I can see the cairo.h header in /home/fong/usr/local/include/cairo. I
> been trying to scouring the internet for answers, but I can't seem to find
> any work for me. If anyone has any suggestions that would be helpful.
> Thanks
>> sessionInfo()
> R version 3.1.0 (2014-04-10)
> Platform: x86_64-unknown-linux-gnu (64-bit)
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C
>           LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] vimcom.plus_0.9-93 setwidth_1.0-3     colorout_1.0-2
> loaded via a namespace (and not attached):
> [1] tcltk_3.1.0 tools_3.1.0
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list