macosrcairo

Error in Installing the Cairo R Package


I am attempting to install the Cairo package in the development version of R on Mac OS X 10.7.4, but I'm running into an issue that I cannot resolve.

I have installed Cairo with homebrew (i.e., brew install cairo) and received the following message:

==> Caveats This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this program and installing another version in parallel can cause all kinds of trouble.

The Cairo provided by Leopard is too old for newer software to link against.

Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add its lib & include paths to your build variables:

LDFLAGS  -L/usr/local/Cellar/cairo/1.12.2/lib
CPPFLAGS -I/usr/local/Cellar/cairo/1.12.2/include

With the above message in mind, I attempted to install the Cairo package from R-Forge with the following R command:

install.packages("Cairo", repos="http://www.rforge.net/", configure.args = c("CAIRO_LIBS=/usr/local/Cellar/cairo/1.12.2/lib", "CAIRO_CFLAGS=/usr/local/Cellar/cairo/1.12.2/include/cairo"))

I receive the following error:

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’

I repeated the same command without the repos argument (by default, I use the FHCRC mirror) with the same result.

At this point, the problem seems obvious: the file cairo.h is not present. But then I listed the files in the include/cairo directory. Here's the response:

ls /usr/local/Cellar/cairo/1.12.2/include/cairo

cairo-deprecated.h cairo-ft.h cairo-ps.h cairo-script-interpreter.h cairo-svg.h cairo-xcb.h cairo-xlib.h cairo-features.h cairo-pdf.h cairo-quartz.h cairo-script.h cairo-version.h cairo-xlib-xrender.h cairo.h

So, I'm pointing the installation of the Cairo package to the appropriate place, but the error persists. I have tried variations, such as CAIRO_CFLAGS=/usr/local/Cellar/cairo/1.12.2/include, with no luck.

Thoughts? Any help you can provide is greatly appreciated.

In case it's necessary, here is my sessionInfo:

R Under development (unstable) (2012-08-08 r60208) Platform: x86_64-apple-darwin11.4.0 (64-bit)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils
datasets methods base

other attached packages: [1] BiocInstaller_1.5.12

loaded via a namespace (and not attached): [1] tools_2.16.0


Solution

  • A coworker and I just fixed the problem by ignoring all of what I typed above. Rather, we installed Cairo and all of its dependencies from source manually, thereby bypassing the usage of brew or variants like port. This worked like a charm, so I am not entirely sure what was wrong above.