To install in R library(devtools) install_github("JingyuHe/XBART")
For mac users seeing error clang: error: unsupported option '-fopenmp'
It is because the default C++ compiler on Mac does not support openmp.
To solve it
-
Install necessary packages via homebrew
brew cask install gfortran
brew install llvm boost libomp
-
Run the following code in the terminal, under your user directory (/Users/your_user_name)
mkdir -p ~/.R
cd .R
touch Makevars
open -e Makevars
-
Then the text editor pops out, copy and paste the following lines to the file
CC=/usr/local/opt/llvm/bin/clang
CXX=/usr/local/opt/llvm/bin/clang++
CXX11=/usr/local/opt/llvm/bin/clang++
CXX14=/usr/local/opt/llvm/bin/clang++
CXX17=/usr/local/opt/llvm/bin/clang++
CXX1X=/usr/local/opt/llvm/bin/clang++
LDFLAGS=-L/usr/local/opt/llvm/lib
-
Save, exit and reboot your Mac