xgboost R软件包安装失败

时间:2017-01-19 09:24:50

标签: r xgboost

我想将xgboost R软件包从0.4-4更新到最新的CRAN版本。使用

启动安装
options(repos = c(CRAN = "https://mran.microsoft.com/snapshot/2017-01-19"))
install.packages("xgboost")

会产生以下消息

installing *source* package 'xgboost' ...
** package 'xgboost' successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
** libs
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c xgboost_R.cc -o xgboost_R.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'xgboost_R.o' failed
make: [xgboost_R.o] Error 127 (ignored)
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c xgboost_custom.cc -o xgboost_custom.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'xgboost_custom.o' failed
make: [xgboost_custom.o] Error 127 (ignored)
gcc -std=gnu99 -I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION    -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c xgboost_assert.c -o xgboost_assert.o
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c amalgamation/xgboost-all0.cc -o amalgamation/xgboost-all0.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'amalgamation/xgboost-all0.o' failed
make: [amalgamation/xgboost-all0.o] Error 127 (ignored)
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c amalgamation/dmlc-minimum0.cc -o amalgamation/dmlc-minimum0.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'amalgamation/dmlc-minimum0.o' failed
make: [amalgamation/dmlc-minimum0.o] Error 127 (ignored)
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c rabit/src/engine_empty.cc -o rabit/src/engine_empty.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'rabit/src/engine_empty.o' failed
make: [rabit/src/engine_empty.o] Error 127 (ignored)
I/usr/lib64/microsoft-r/3.3/lib64/R/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -DU_STATIC_IMPLEMENTATION   -fopenmp     -c rabit/src/c_api.cc -o rabit/src/c_api.o
sh: I/usr/lib64/microsoft-r/3.3/lib64/R/include: No such file or directory
/usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf:139: recipe for target 'rabit/src/c_api.o' failed
make: [rabit/src/c_api.o] Error 127 (ignored)
-shared -L/usr/lib64/microsoft-r/3.3/lib64/R/lib -o xgboost.so ./xgboost_R.o ./xgboost_custom.o ./xgboost_assert.o ./amalgamation/xgboost-all0.o ./amalgamation/dmlc-minimum0.o ./rabit/src/engine_empty.o ./rabit/src/c_api.o -fopenmp -L/usr/lib64/microsoft-r/3.3/lib64/R/lib -lR
sh: line 2: -shared: command not found
/usr/lib64/microsoft-r/3.3/lib64/R/share/make/shlib.mk:6: recipe for target 'xgboost.so' failed
make: *** [xgboost.so] Error 127
ERROR: compilation failed for package 'xgboost'
* removing '/home/norbert/R/x86_64-pc-linux-gnu-library/3.3/xgboost'
* restoring previous '/home/norbert/R/x86_64-pc-linux-gnu-library/3.3/xgboost'
Warning in install.packages :
  installation of package ‘xgboost’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpvbYF34/downloaded_packages’

似乎xgboost_assert.c编译正确,但用于编译文件* .cc的命令不正确 - 缺少命令的开头。最终的链接命令也是如此。

sessionInfo()

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

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

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

other attached packages:
[1] RevoUtilsMath_10.0.0

loaded via a namespace (and not attached):
[1] RevoUtils_10.0.2 tools_3.3.2     

知道该怎么做?

1 个答案:

答案 0 :(得分:5)

这在Microsoft R上很常见,问题是Microsoft-R无法检测到c ++ 11

修复此问题,编辑" /usr/lib64/microsoft-r/3.3/lib64/R/etc/Makeconf"

将此添加到底部
CXX1X = gcc -std = c ++ 0x
CXX1XSTD = -std = c ++ 0x -fPIC

希望这个帮助,