0

I tried to install the R package "lightgbm" with devtools on mac (High Sierra 10.13.5; R version 3.5.0; devtools 1.13.5).

However an error occurred and the message below was showed.

> library(devtools)
> install_github("Microsoft/LightGBM", subdir = "R-package")
Downloading GitHub repo Microsoft/LightGBM@master
from URL https://api.github.com/repos/Microsoft/LightGBM/zipball/master
Installing lightgbm
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  '/private/var/folders/5n/8jscplj12gg0b6_p9h_rqcmc0000gn/T/RtmpNnPRWk/devtools35b1eee5504/Microsoft-LightGBM-c0147cb/R-package'  \
  --library='/Library/Frameworks/R.framework/Versions/3.5/Resources/library' --install-tests 

* installing *source* package ‘lightgbm’ ...
** libs
installing via 'install.libs.R' to /Library/Frameworks/R.framework/Versions/3.5/Resources/library/lightgbm
-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:27 (message):
  AppleClang isn't supported.  Please see
  https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#macos


-- Configuring incomplete, errors occurred!
See also "/private/var/folders/5n/8jscplj12gg0b6_p9h_rqcmc0000gn/T/RtmpNnPRWk/devtools35b1eee5504/Microsoft-LightGBM-c0147cb/R-package/src/build/CMakeFiles/CMakeOutput.log".
make: *** No rule to make target `_lightgbm'.  Stop.
Error in eval(ei, envir) : Cannot find lib_lightgbm.so
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/lightgbm’
Installation failed: Command failed (1)
Warning message:
GitHub repo contains submodules, may not function as expected! 

So I'd like to use gcc (I installed it via homebrew) instead of AppleClang.

How can I do it?

Thanx

toshi71
  • 23
  • 4

1 Answers1

0

The complete steps I took. Updated gcc with homebrew. Probably unnecessary - it made me gcc-8.

I didn't track all the links I found for work arounds so just giving the steps.

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM

mkdir build ; cd build

cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 ..

export PATH=/usr/bin:$PATH

make -j4

This built it but it didn't seem to be for R. So...

cd ..

cd R-package

R CMD INSTALL --build . --no-multiarch

Seemed to remember prior settings and again built it successfully for R. At least 'library(lightgbm)' worked. That's as far as I've gotten.

Todd Sewell
  • 1,444
  • 12
  • 26