0
votes

Am trying to install the R Rcpp package on Mac OS X El Capitan with a homebrew installation of R in an R console

> install.packages("Rcpp")
Installing package into ‘/usr/local/lib/R/3.3/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-        project.org/src/contrib/Rcpp_0.12.5.tar.gz'
Content type 'application/x-gzip' length 2397088 bytes (2.3 MB)
==================================================
downloaded 2.3 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/usr/local/Cellar/r/3.3.1/R.framework/Resources/include -    DNDEBUG -I/usr/local/include -I/usr/local/opt/ -    I/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../include -    I/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../i nclude/darwin -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include    -fPIC  -g -O2  -c Date.cpp -o Date.o
Date.cpp:31:10: fatal error: 'Rcpp.h' file not found
#include <Rcpp.h>
     ^
1 error generated.
make: *** [Date.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/usr/local/lib/R/3.3/site-library/Rcpp’

The downloaded source packages are in
‘/private/var/folders/g8/rqv40nhs3zqcntnz_9t9l60w0000gr/T/Rtmpq2VPG3/    downloaded_packages’
Warning message:
In install.packages("Rcpp") :
  installation of package ‘Rcpp’ had non-zero exit status

Tried searching for Rcpp.h with:

$locate Rcpp.h
/usr/local/lib/R/3.2/site-library/Rcpp/include/Rcpp.h

I could symlink to the R/3.2 directory, but that seems risky ?

Tried:

brew update; brew install Rcpp  

Received:

Error: No available formula with the name "rcpp" ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps.

Session information:

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin15.5.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)

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     

loaded via a namespace (and not attached):
[1] tools_3.3.1
3
Firstly, homebrew != standard R compilation. And definitely do not symlink to R3.2. Did you previously use R via homebrew or is this the first time? I ask as I'm wondering if the formula setup the correct flags.coatless
Yes, I had installed R 3.2 via homebrew also. Don't recall any Rcpp installation issues then.bdanalytics

3 Answers

2
votes

First, uninstall any previous dependencies via:

brew uninstall r

Next, try to install R under the following brew statements:

# Grab xquartz
brew install cask
brew cask install xquartz

# Install R w/ GCC (compiled under)
brew tap homebrew/science
brew install gcc
brew install r

Then try:

install.packages("Rcpp")
0
votes

Downloaded the tar file from CRAN into a separate directory (e.g /tmp). tar -x Rcpp<*>.tar.gz. Added -I/tmp/Rcpp/inst/include to PKG_CPPFLAGS in my R Makevars file. In the R console install.packages("Rcpp"). Still don't know why the "normal" / "standard" process does not work

0
votes

Turn off any antivirus like McAfee and then you should be able to install the packages with no issues. It solved my problem.