[R-package] Create portable configuration with 'configure' scripts #2960
Description
With recent changes (see #629 (comment)), the R package is getting closer to being ready for CRAN.
I tried to submit the R package as of #2936 to the win-builder service. This is a free service that allows you to get an early glimpse into how CRAN checks will go for a package, specifically on the various Windows configurations used by CRAN.
The results were not good...the R package cannot be built because CMake
isn't available in CRAN check farms.
*** arch - i386
installing via 'install.libs.R' to d:/RCompile/CRANguest/R-devel/lib/00LOCK-lightgbm/00new/lightgbm
[1] "Trying to build with: 'Visual Studio 16 2019'"
Warning in system(paste0(tmp_cmake_cmd, " ..")) : 'cmake' not found
[1] "Trying to build with: 'Visual Studio 15 2017'"
Warning in system(paste0(tmp_cmake_cmd, " ..")) : 'cmake' not found
[1] "Trying to build with: 'Visual Studio 14 2015'"
Warning in system(paste0(tmp_cmake_cmd, " ..")) : 'cmake' not found
Warning in system(paste0(cmake_cmd, " ..")) : 'cmake' not found
Warning in system(build_cmd) : 'cmake' not found
Error in eval(ei, envir) : Cannot find lib_lightgbm.dll
* removing 'd:/RCompile/CRANguest/R-devel/lib/lightgbm'
I see some evidence on GitHub issues that we shouldn't assume CMake
is there, but then other packages currently on CRAN do seem to assume it. For example, qtbase, Eigen, and 50+ other packages.
In Writing R Extensions, I see the following:
If your package needs some system-dependent configuration before installation you can include an executable (Bourne) shell script configure in your package which (if present) is executed by R CMD INSTALL before any other action is performed. This can be a script created by the Autoconf mechanism, but may also be a script written by yourself. Use this to detect if any nonstandard libraries are present such that corresponding code in the package can be disabled at install time rather than giving error messages when the package is compiled or used. To summarize, the full power of Autoconf is available for your extension package (including variable substitution, searching for libraries, etc.).
Projects similar to LightGBM
have taken this approach.
xgboost
(configure, configure.ac, configure.win)catboost
(configure, configure.ac, configure.win)
I think that to get to CRAN, we're going to have to either figure out if there is a way to assume CMake
availability or we're going to have to create these configure
scripts and create a build script that doesn't explicitly require CMake
. To start addressing this issue, it would be good to download a source tarball of xgboost
and compare the contents of that package to what is in their repo and what is created with make Rpack
from that repo.
Activity