无法从CRAN安装xgboost

小凤李

当我想在cenos7(是wsl2)中从cran安装xgboost时,出现了此错误,并且我无法通过Google找到任何提示消息:

In file included from amalgamation/xgboost-all0.cc:68:0:
amalgamation/../src/learner.cc: In member function ‘virtual void xgboost::LearnerImpl::SaveModel(xgboost::Json*) const ’:
amalgamation/../src/learner.cc:378:24: error: invalid initialization of non-const reference of type ‘xgboost::Json&’ from an rvalue of type ‘<brace-enclosed initializer list>’
     Json& out { *p_out };
                        ^
amalgamation/../src/learner.cc: In member function ‘virtual void xgboost::LearnerImpl::SaveConfig(xgboost::Json*) cons
’:
amalgamation/../src/learner.cc:441:24: error: invalid initialization of non-const reference of type ‘xgboost::Json&’ from an rvalue of type ‘<brace-enclosed initializer list>’
     Json& out { *p_out };
                        ^
make: *** [amalgamation/xgboost-all0.o] Error 1
ERROR: compilation failed for package ‘xgboost’
* removing ‘/usr/lib64/R/library/xgboost’

该环境是:

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0

默认的gcc版本是4.8.5,为了编译“ rstan”,我写了

CXX14 = g++ -std=c++1y
CXX14FLAGS += -fPIC

进入文件〜/ .R / Makevars

如何成功安装xgboost?

jared_mamrot

尝试从github(https://xgboost.readthedocs.io/en/latest/build.html#installing-the-development-version开发包

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update
mkdir build
cd build
cmake .. -DR_LIB=ON
make -j$(nproc)
make install

使用默认目标时,将在构建区域中构建R包共享库。此外,安装目标还会在build / R-package下使用此共享库汇编软件包文件,并运行R CMD INSTALL。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章