1

I am trying to install a R package (spdep) on a OS X 10.9 Mavericks, with R 3.0.1 (sessionInfo at the bottom). The package was downloaded from http://cran.r-project.org/web/packages/spdep/index.html (source file spdep_0.5-71.tar.gz), and I tried to install it via terminal using R CMD INSTALL.

The problem is that terminal yields this error:

ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [spdep.so] Error 1
ERROR: compilation failed for package ‘spdep’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/spdep’

I tried to re-install Xcode and the command line tools, which I already had. And I also installed gfortran-4.8.2-darwin13.tar.bz2 doing sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 in the terminal. But it still gives me the same error.

Any solution?

Thanks!

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
rafa.pereira
  • 13,251
  • 6
  • 71
  • 109
Fran Villamil
  • 491
  • 4
  • 13
  • That package also fails compilation at CRAN when using R 3.1.0 with Mavericks. Your session info says you are using R 3.1.0. When a similar problem was reported on the R-Mac-SIG Prof Ripley said there were instructions in the R Admin document. https://stat.ethz.ch/pipermail/r-sig-mac/2014-April/010833.html – IRTFM Jun 01 '14 at 00:13
  • Yes, I had seen that document, and I think it points to http://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X and http://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages . Anyway, I installed the fortran library Prof Ripley mentions, but with no result. Maybe I have to change the default compiler settings, but I do not know how. – Fran Villamil Jun 01 '14 at 06:58

2 Answers2

0

I made it worked by changing the permissions .

sudo chmod -R 755 /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/*

maybe don't need to change all the files but just directories, you can try your own .

Shu Zhang
  • 521
  • 12
  • 20
0

The solution should be on that website

In few words, it is necessary to install gfortran, and set environment variables in the terminal by creating a Makevars file on that path ~/.R/Makevars.

C. Guff
  • 418
  • 3
  • 18