LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

Relative paths in R-package prevent source package build

Open areobe opened this issue 9 years ago • 4 comments

Environment info

Operating System: Scientific Linux 6 R version: MRO 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"

Summary

We are unable to build a source R package from your git repo. This is an issue for us because we keep the source R package tar.gz in our source control and deploy from there using install.packages().

Error Message:

fatal error: ../../src/application/application.cpp: No such file or directory

Reproducible examples

Run R CMD build Run R CMD INSTALL

Steps to reproduce

  1. [root@r3 src]# git clone --recursive https://github.com/Microsoft/LightGBM.git

  2. [root@r3 src]# cd LightGBM

  3. [root@r3 LightGBM]# cd R-package

  4. [root@r3 R-package]# R CMD build --no-build-vignettes .

  5. [root@r3 R-package]# R CMD INSTALL lightgbm_0.1.tar.gz

WARNING: ignoring environment value of R_HOME
* installing to library ‘/tmp/rlibs’
* installing *source* package ‘lightgbm’ ...
** libs
g++ -std=c++0x -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I../..//include -DUSE_SOCKET -Wno-deprecated-declarations -DU_STATIC_IMPLEMENTATION   -fopenmp  -std=c++11   -fpic -c lightgbm-all.cpp -o lightgbm-all.o
lightgbm-all.cpp:2:49: fatal error: ../../src/application/application.cpp: No such file or directory
 #include "../../src/application/application.cpp"
                                                 ^
compilation terminated.
make: *** [lightgbm-all.o] Error 1
ERROR: compilation failed for package ‘lightgbm’
* removing ‘/tmp/rlibs/lightgbm’
* restoring previous ‘/tmp/rlibs/lightgbm’

areobe avatar Mar 08 '17 20:03 areobe

can you use devtools::install_github("Microsoft/LightGBM", subdir = "R-package") to install?

guolinke avatar Mar 09 '17 00:03 guolinke

This is an issue for us because we keep the source R package tar.gz in our source control and deploy from there using install.packages().

Are you able to keep the whole source locally (instead of just the package) and use devtools::install(<path to the R-package>) inside R ? (command line or interactive shell does not matter)

Laurae2 avatar Mar 09 '17 11:03 Laurae2

A plain R CMD INSTALL . works fine from within the R-package directory. We just need to source tar.gz to be self contained much like any other package in CRAN/MRAN.

MXNet has a similar setup where they compile a common shared library first then use that in their R package. See: http://mxnet.io/get_started/amazonlinux_setup.html#install-the-mxnet-package-for-r In their Makefile the rpkg task runs the R CMD build after copying the .so dependency.

areobe avatar Mar 09 '17 15:03 areobe

@areobe you can try the latest code.

guolinke avatar Mar 10 '17 06:03 guolinke