Multithread R installation fails macOS Mojave 10.14.2

Hi There, I’ve been trying to install xgboost with multithread support in R.

I followed the instructions here,

brew install gcc@7
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
mkdir build
cd build
CC=gcc-7 CXX=g++-7 cmake .. -DR_LIB=ON
make -j4
make install

but when I try and actually run make -j4, I get the following error

[  4%] Built target rabit
[ 24%] Built target dmlc
[ 98%] Built target objxgboost
[100%] Linking CXX shared library xgboost.so
ld: framework not found R
collect2: error: ld returned 1 exit status
make[2]: *** [xgboost.so] Error 1
make[1]: *** [CMakeFiles/xgboost.dir/all] Error 2
make: *** [all] Error 2

I’ve exhausted my google abilities on this so thought I’d ask here.

Thanks!

System information

Using R version 3.5.2 (2018-12-20) – “Eggshell Igloo”
ProductName: Mac OS X
ProductVersion: 10.14.2
BuildVersion: 18C54
abalone:build danovan$ R

Model Name: MacBook Pro
Model Identifier: MacBookPro15,1
Processor Name: Intel Core i9
Processor Speed: 2.9 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Memory: 32 GB
Boot ROM Version: 220.230.16.0.0 (iBridge: 16.16.2542.0.0,0)
Serial Number (system): C02XJ4K8JGH6
Hardware UUID: 6AE66135-8881-5AA7-9BA3-33C812131F12
1 Like

How did you install R?

Thanks for taking a look at this, I used the .pkg installer from CRAN

I tried installing R from homebrew as well and that didn’t fix it either

Same steps, config and error here too.

1 Like

Also dealing with this error.

My installation steps:

brew upgrade cmake
brew upgrade gcc
cd ~/Documents/Projects/R
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost/
mkdir build
cd build
CC=gcc-8 CXX=g++-8 cmake .. -DR_LIB=ON
make -j4

This is after installing R 3.6.0 on mac osx.

Can you re-install R, per suggestion in https://bitbucket.org/statgen/plinkseq/issues/3/rplinkseq-fails-to-compile-framework-not ?

Thanks for the link and suggestion @hcho3 but reinstalling R did not work. Note that I tried reinstalling R a few different ways including completely removing my R installation before installing 3.6.0 and installing clang 7.0.0 and gfortran 6.1 as suggested here.

@ben519 Have you tried using Homebrew to install R?

I personally use Macbook Pro but never had issues installing XGBoost. Sorry I’m not of much help here

@hcho3 I haven’t tried using Homebrew to install R. The data.table guys warn against this and I’m pretty sure I’ve had issues with it in the past. Did you install R using Homebrew?

Can you confirm that you’ve successfully installed xgboost multithread version on your mac using R 3.6.0? If so, is your installation technique any different than my own?

I’ll put this on Stack Overflow to see if anyone smarter than myself has a suggestion. Perhaps it is an R issue and not an xgboost one, as you’ve indicated.

UPDATE: I removed R, then reinstalled using brew install r (thanks for the suggestion @hcho3). After that I was able to install xgboost multithread version without issue, as well as all the other packages I need. So far, I haven’t noticed any issues using homebrew’s installation of R (except that every package needs to be installed from source, but hey it works.)

@ben519 That’s great to hear!

Multithreading on Mac OSX has been a pain because the pre-installed compiler on OSX doesn’t support OpenMP. So install.packages('xgboost') will give you single-threaded XGBoost. One way to solve it is to remove OpenMP dependency entirely from XGBoost and use custom threading instead, but that will require substantial amount of dev hours.

@hcho3 Thanks, that makes sense. Just a note - data.table uses OpenMP for multithreading and their installation has always worked well (and been easy) for me. But I’m guessing xgboost is more complex and has more dependencies to deal with.