简体   繁体   中英

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 (ie, 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

I had similar issue with cairo config error, and I already installed cairo with homebrew. Try below

brew install pkg-config

This solved mine problem.

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.

In ubuntu, you only need to install libcairo2-dev from reposiories ( sudo apt-get install libcairo2-dev ). After that, installing Cairo package works like a charm.

After trying everything listed here, I found this blog post about installing the "full R package" using brew: https://luispuerto.net/blog/2018/05/11/installing-r-with-homebrew-with-all-the-capabilities/

What finally worked for me was building R explicitly with cairo (brew's default R tap uses --without-cairo and simply editing the tap did not solve the issue for me).

Works like a charm for me with R 4.0.2, cairo 1.16.0_3 under macOS Catalina 10.15.6.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM