22

I want to install the Cairo package in R using:

install.packages("Cairo")

Unfortunately this doesn't work. The error message is following:

xlib-backend.c:34:74: fatal error: X11/Intrinsic.h: No such file or directory
compilation terminated.
make: *** [xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/home/magnus/R/x86_64-pc-linux-gnu-library/3.1/Cairo’

Does anybody have an answer for this problem? I couldn't find any help in the internet so far.

Many thanks in advance!

Yours,

broesel

Magnus Metz
  • 626
  • 2
  • 7
  • 19
  • Try this [link]. (http://stackoverflow.com/questions/9437246/unable-to-install-cairo-package-under-linux). Make sure that to have X11 installed. – flamenco May 13 '14 at 22:19

7 Answers7

33

For me (Ubuntu 15.04) installing libxt-dev solved the problem.

(I know it's mentioned in comments above, but thought it might be good to have it in answers as well)

Filip
  • 478
  • 4
  • 8
24

You need the development header as the file Intrinsic.h is not found.

For the related package cairoDevice (which I maintain for Debian), I ensure the following is installed:

libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base

If you are on a different distribution these might be called something else. The key is that the Gtk and Cairo header packages also pull in other, needed, x11 packages.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Hello. Thank you for your answer, although I doubt that I fully understand what you meant. I am using Ubuntu. I made sure that all of `libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base` are installed, but the error remained. I didn't really git the second part of your answer. What does that mean and which consequences does that have for my further actions? Thank you... – Magnus Metz May 13 '14 at 22:28
  • 7
    It helps that you shared the fact that you use Ubuntu. Intrinsic.h is contained in the package `libxt-dev` which should have been installed with the other ones. Make sure you also have `r-base-dev` installed. – Dirk Eddelbuettel May 13 '14 at 22:31
  • 11
    `r-base-dev` is installed, but `libxt-dev` wasn't. After installing `libxt-dev` I was able to install Cairo in R. Thanks! – Magnus Metz May 13 '14 at 22:51
  • Cool. You can use packages.ubuntu.com to search for packages given a filename. Helpful when missing headers like here. – Dirk Eddelbuettel May 13 '14 at 22:56
  • 2
    For anyone else using Centos the package that provides Intrinsic.h is `libXt-devel` – mlegge Mar 16 '17 at 18:19
11

libXt-devel needs to be installed in Fedora (25):

sudo dnf install libXt-devel
Jot eN
  • 6,120
  • 4
  • 40
  • 59
9

On a Mac, my problems were solved once I installed libxt

brew install libxt

Similar, I'm sure to https://stackoverflow.com/a/41455437/61728

fratrik
  • 1,700
  • 2
  • 15
  • 17
5

Along with the packages libgtk2.0-dev, libcairo2-dev, xvfb, xfonts-base and xauth that Dirk mentioned in the above comment , I also installed libxt-dev (after Magnus' comment) after which I was able to install Cairo in R. I am using Ubuntu 16.04 LTS

Community
  • 1
  • 1
Kalmesh V
  • 51
  • 1
  • 1
  • This option worked for me too. I installed packages in the Terminal window in Ubuntu 20.04. I also added `libxt-dev` package before installing `Cairo` from R environment. – dkolkin Apr 28 '23 at 07:21
1

I had a lot of trouble with this, for some reason this didn't work

apt-get install libx11-dev libxt-dev libgtk2.0-dev libcairo2-dev xvfb xauth xfonts-base -y

but when I ran this immediately afterwards (even though it was already installed above), then the Cairo R package installed successfully. Not exactly sure why but thought I'd put it here in case it helps someone.

apt-get install libcairo2-dev -y
stevec
  • 41,291
  • 27
  • 223
  • 311
0

I used this:

devtools::install_github("jcassiojr/BayesPeak")

then:

library("BayesPeak")

And worked. Paulo