Install ou update RcppArmadillo package in MacOSX Sierra

If the update is done with clang++ installed with Xcode, installation will fail. You must install a specific version of clang++.

First install homebrew, using in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install llvm
brew install --with-clang llvm

Then, you will find clang++ on /usr/local/opt/llvm/bin/clang++. You can add these lines in the .profile:

PATH="/usr/local/opt/llvm/bin:${PATH}"
export PATH

Run R in terminal, and in R, enter:
install.packages("RcppArmadillo")

The correct clang++ will be find and compilation works.

Note that different versions of clang++ are used if you run RStudio or R in terminal:
In RStudio:
> system("clang++ --version")
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

In R in terminal:
> system("clang++ --version")
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin16.6.0
Thread model: posix

InstalledDir: /usr/local/opt/llvm/bin

In R GUI in application folder:

> system("clang++ --version")
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

It is possible to use Rstudio with the correct version of clang++ if you run Rstudio from terminal:

open -a Rstudio

Then in Rstudio:

> system("clang++ --version")
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Install treemix in ubuntu 20.04