4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Homebrew で R をインストールする時に cairo.h がないエラーになるので cairo を外して回避する

Last updated at Posted at 2014-01-08

brew install r が以下のようにエラーとなる。

$ brew tap homebrew/science
Cloning into '/usr/local/Library/Taps/homebrew-science'...
(略)
$ brew doctor
Your system is ready to brew.
$ brew install r
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://cran.r-project.org/src/base/R-3/R-3.0.2.tar.gz
(略)
/private/tmp/r-pW8z/R-3.0.2/lib/libRlapack.dylib is unchanged
make[1]: *** [R] Error 1
make: *** [R] Error 1

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/homebrew/homebrew-science/issues

These open issues may also help:
    https://github.com/Homebrew/homebrew/issues/23009
    https://github.com/Homebrew/homebrew/issues/18947
    https://github.com/Homebrew/homebrew/issues/15900
    https://github.com/Homebrew/homebrew/issues/15909
    https://github.com/Homebrew/homebrew/issues/22806
    https://github.com/Homebrew/homebrew/pull/6427
    https://github.com/Homebrew/homebrew/pull/6428
$

Using Homebrew-provided fortran compiler. とあるので gfortran は入れる必要ないようだ。

エラーログをファイルにとる。

$ HOMEBREW_MAKE_JOBS=1 brew install -v r 2>&1 > _brew.log
Error: r did not build
$

_brew.log を見ると

(略)
In file included from devX11.c:72:
./devX11.h:62:12: fatal error: 'cairo.h' file not found
#  include <cairo.h>
           ^
1 error generated.
make[3]: *** [devX11.d] Error 1
make[2]: *** [make.X11] Error 2
make[1]: *** [R] Error 1
make: *** [R] Error 1
==> Formula
(略)

cairo.h が見つからなくてエラーになっている。

$ brew upgrade cairo
Error: cairo-1.12.16 already installed

cairo は最新。

R depends on cairo? を参考に、brew edit r して configure のオプションで cairo を外す。

$ brew edit r

エディタが立ち上がるので、以下のような部分を探して、

  def install
    args = [
      "--prefix=#{prefix}",
      "--with-aqua",
      "--enable-R-framework",
    ]

ここに --without-cairo を付け加える。

  def install
    args = [
      "--prefix=#{prefix}",
      "--with-aqua",
      "--enable-R-framework",
      "--without-cairo",
    ]

すると brew install r で R がインストールされる。このように cairo を外すと、きっとグラフィックス機能の一部が使えなくなるだろうと思う。

4
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?