简体   繁体   中英

Installing R package (spdep) in OS X from source --- compilation error

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)

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 .

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 .

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