diff --git a/.ci/test_r_package_valgrind.sh b/.ci/test_r_package_valgrind.sh index 2a6ce8dc7f9a..80a2830b7422 100755 --- a/.ci/test_r_package_valgrind.sh +++ b/.ci/test_r_package_valgrind.sh @@ -1,6 +1,6 @@ #!/bin/bash -RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" || exit -1 +RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" || exit -1 sh build-cran-package.sh || exit -1 RDvalgrind CMD INSTALL --preclean --install-tests lightgbm_*.tar.gz || exit -1 diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index 5c151825cde9..4b72ca15f0ce 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -191,7 +191,7 @@ jobs: - name: Install packages shell: bash run: | - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" sh build-cran-package.sh Rdevel CMD INSTALL lightgbm_*.tar.gz || exit -1 - name: Run tests with sanitizers @@ -221,7 +221,7 @@ jobs: shell: bash run: | export PATH=/opt/R-devel/bin/:${PATH} - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" sh build-cran-package.sh R CMD check --as-cran --run-donttest lightgbm_*.tar.gz || exit -1 if grep -q -E "NOTE|WARNING|ERROR" lightgbm.Rcheck/00check.log; then diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 851c3f7e56bf..cdc917903f46 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -57,7 +57,7 @@ jobs: - name: Install packages shell: bash run: | - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'roxygen2', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'roxygen2', 'testthat'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" sh build-cran-package.sh || exit -1 R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit -1 - name: Test documentation diff --git a/R-package/README.md b/R-package/README.md index e4be3c9a5dc2..c30ddcef85af 100644 --- a/R-package/README.md +++ b/R-package/README.md @@ -374,7 +374,7 @@ docker run \ -it rhub/rocker-gcc-san \ /bin/bash -Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" +Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh @@ -396,7 +396,7 @@ docker run \ -it \ wch1/r-debug -RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" +RDscriptvalgrind -e "install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh diff --git a/R-package/configure.win b/R-package/configure.win index 61c093ad9f65..dfbaa3fc0377 100755 --- a/R-package/configure.win +++ b/R-package/configure.win @@ -6,7 +6,11 @@ ########################### R_EXE="${R_HOME}/bin${R_ARCH_BIN}/R" -CC=`"${R_EXE}" CMD config CC` +CXX11=`"${R_EXE}" CMD config CXX11` +CXX11STD=`"${R_EXE}" CMD config CXX11STD` +CXX="${CXX11} ${CXX11STD}" +CXXFLAGS=`"${R_EXE}" CMD config CXX11FLAGS` +CPPFLAGS=`"${R_EXE}" CMD config CPPFLAGS` # LightGBM-specific flags LGB_CPPFLAGS="" @@ -23,7 +27,7 @@ LGB_CPPFLAGS="${LGB_CPPFLAGS} -DEIGEN_MPL2_ONLY" ac_mm_prefetch="no" -cat > conftest.c < conftest.cpp < int main() { int a = 0; @@ -32,7 +36,7 @@ int main() { } EOL -${CC} -o conftest conftest.c 2>/dev/null && ./conftest && ac_mm_prefetch="yes" +${CXX} ${CXXFLAGS} ${CPPFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_prefetch="yes" echo "checking whether MM_PREFETCH works...${ac_mm_prefetch}" if test "${ac_mm_prefetch}" = "yes"; @@ -45,7 +49,7 @@ fi ############ ac_mm_malloc="no" -cat > conftest.c < conftest.cpp < int main() { char *a = (char*)_mm_malloc(8, 16); @@ -54,7 +58,7 @@ int main() { } EOL -${CC} -o conftest conftest.c 2>/dev/null && ./conftest && ac_mm_malloc="yes" +${CXX} ${CXXFLAGS} ${CPPFLAGS} -o conftest conftest.cpp 2>/dev/null && ./conftest && ac_mm_malloc="yes" echo "checking whether MM_MALLOC works...${ac_mm_malloc}" if test "${ac_mm_malloc}" = "yes";