web-dev-qa-db-ja.com

CRANからxgboostをインストールできません

cenos7(wsl2)のクランから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*) 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を正常にインストールするにはどうすればよいですか?

4
xiaofeng.li

Githubからdevパッケージを試してください( 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を実行します。

0
jared_mamrot