【问题标题】:Install error in xgboost on R CentOS Linux system在 R CentOS Linux 系统上安装 xgboost 报错
【发布时间】:2021-04-22 17:57:28
【问题描述】:

我正在尝试在 centOS 系统上的 R 中安装 xgboost。我是如何结束这一点的,我无法解码。谁能帮我理解并解决它。

the Log

install.packages("xgboost",lib = "/opt/mount1/muthyalv/vm_packages") 尝试 URL 'https://cran.rstudio.com/src/contrib/xgboost_1.3.1.1.tar.gz' 内容类型 'application/x-gzip' 长度 966952 字节 (944 KB) ================================================== 已下载 944 KB

最近的更新我在 R 中执行了以下步骤,但出现此错误

* installing *source* package ‘xgboost’ ...
** package ‘xgboost’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking Backtrace lib... 
checking for backtrace in -lexecinfo... no
checking endian... 
configure: creating ./config.status
config.status: creating src/Makevars
** libs
Makevars:17: -DXGBOOST_STRICT_R_MODE=1
Makevars:17: -DDMLC_LOG_BEFORE_THROW=0
Makevars:17: -DDMLC_ENABLE_STD_THREAD=1
Makevars:17: -DDMLC_DISABLE_STDIN=1
Makevars:17: -DDMLC_LOG_CUSTOMIZE=1
Makevars:17: -DXGBOOST_CUSTOMIZE_LOGGER=1
Makevars:17: -DRABIT_CUSTOMIZE_MSG_
g++ -std=c++1y  -I"/opt/R/3.6.3/lib/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_  -I/usr/local/include -fopenmp -DDMLC_CMAKE_LITTLE_ENDIAN=1 -pthread   -O3 -Wno-unused-variable -Wno-unused-function -c xgboost_R.cc -o xgboost_R.o
g++ -std=c++1y  -I"/opt/R/3.6.3/lib/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_  -I/usr/local/include -fopenmp -DDMLC_CMAKE_LITTLE_ENDIAN=1 -pthread   -O3 -Wno-unused-variable -Wno-unused-function -c xgboost_custom.cc -o xgboost_custom.o
In file included from xgboost_custom.cc:6:0:
./dmlc-core/include/../../src/common/random.h: In function ‘std::vector<T> xgboost::common::WeightedSamplingWithoutReplacement(const std::vector<T>&, const std::vector<float>&, size_t)’:
./dmlc-core/include/../../src/common/random.h:102:49: error: wrong number of template arguments (0, should be 1)
   auto ind = ArgSort<size_t>(keys, std::greater<>{});
                                                 ^
In file included from /usr/include/c++/4.8.2/string:48:0,
                 from ./dmlc-core/include/dmlc/logging.h:12,
                 from ./include/xgboost/logging.h:11,
                 from xgboost_custom.cc:5:
/usr/include/c++/4.8.2/bits/stl_function.h:222:12: error: provided for ‘template<class _Tp> struct std::greater’
     struct greater : public binary_function<_Tp, _Tp, bool>
            ^
make: *** [xgboost_custom.o] Error 1
ERROR: compilation failed for package ‘xgboost’
* removing ‘/opt/mount1/muthyalv/vm_packages/xgboost’
Warning in install.packages :
  installation of package ‘xgboost’ had non-zero exit status

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

在此之前,我遇到了一个 c14xx 错误,我通过创建 Makevars 解决了这个错误。

我目前在这里感到震惊。你能帮我么

在这里也附上我的 Makevars 内容。

【问题讨论】:

    标签: r centos xgboost


    【解决方案1】:

    这取决于您使用的编译器。

    XGBoost 需要支持 C++14 标准的最新 C++ 编译器:例如,GCC 5。

    我不确定,但这可能是您的问题的原因,因为 std::greater 是 C++14 中更改的函数之一。

    【讨论】:

    • 如何解决 g++ 错误,第一个错误中有一个“=:”,是否与此有关。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-06
    • 2017-01-19
    • 2013-08-07
    • 1970-01-01
    • 1970-01-01
    • 2017-11-02
    • 2017-04-03
    相关资源
    最近更新 更多