在R中安装最新版本的xgboost时出错

问题描述 投票:0回答:1

嗨,尝试时遇到以下错误

    `install.packages("xgboost")`

错误消息:

`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*) const’:
 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’`

─会议信息────────────────────────────────── ──────────────────────]

setting  value                       
version  R version 3.6.0 (2019-04-26)
os       Red Hat Enterprise Linux    
system   x86_64, linux-gnu           
ui       RStudio                     
language (EN)                        
collate  en_AU.UTF-8                 
ctype    en_AU.UTF-8                 
tz       Australia/Brisbane          
date     2020-06-08  

但是,可以安装较旧的存档版本

packageurl <- "http://cran.r- 
project.org/src/contrib/Archive/xgboost/xgboost_0.90.0.2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
r compiler-errors xgboost
1个回答
0
投票

[如果您是从源代码构建的,也许值得通过命令行(https://xgboost.readthedocs.io/en/latest/build.html#installing-the-development-version)从github尝试dev软件包:

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
© www.soinside.com 2019 - 2024. All rights reserved.