当我想从cenos 7中的cran安装xgboost(这是wsl 2)我得到了这个错误,我找不到任何线索通过谷歌的消息:
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’
env是:
> 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?
1条答案
按热度按时间iqjalb3h1#
试试github上的dev包(https://xgboost.readthedocs.io/en/latest/build.html#installing-the-development-version):
当使用默认目标时,将在构建区域中构建R包共享库。此外,安装目标将在build/R-package下使用此共享库组装包文件并运行R CMD INSTALL。