Error Installing "xgboost" on R 4.0.2 on Linux Machine

R Version: 4.0.2
OS : Linux
Package Name : xgboost
gcc version : 4.8.5

I have tried the following commands:

install.packages('xgboost')

Installing package into ‘/home/<username>/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/xgboost_1.1.1.1.tar.gz'
Content type 'application/x-gzip' length 929560 bytes (907 KB)
==================================================
downloaded 907 KB

* 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_
Makevars:17: -DRABIT_STRICT_CXX98_
g++ -std=gnu++11 -I"/usr/local/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_  -I/usr/local/include  -fopenmp -DDMLC_CMAKE_LITTLE_ENDIAN=1 -pthread -fpic  -g -O2  -c xgboost_R.cc -o xgboost_R.o
g++ -std=gnu++11 -I"/usr/local/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_  -I/usr/local/include  -fopenmp -DDMLC_CMAKE_LITTLE_ENDIAN=1 -pthread -fpic  -g -O2  -c xgboost_custom.cc -o xgboost_custom.o
gcc -std=gnu99 -I"/usr/local/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_  -I/usr/local/include   -fpic  -g -O2  -c xgboost_assert.c -o xgboost_assert.o
gcc -std=gnu99 -I"/usr/local/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_  -I/usr/local/include   -fpic  -g -O2  -c init.c -o init.o
g++ -std=gnu++11 -I"/usr/local/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=1 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_  -I/usr/local/include  -fopenmp -DDMLC_CMAKE_LITTLE_ENDIAN=1 -pthread -fpic  -g -O2  -c amalgamation/xgboost-all0.cc -o amalgamation/xgboost-all0.o
In file included from amalgamation/../src/metric/elementwise_metric.cc:7:0,
                 from amalgamation/xgboost-all0.cc:14:
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowRMSE]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalRowRMSE>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalRowRMSE]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:352:73: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowRMSE]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalRowRMSE>(); });
                                                                         ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowRMSLE]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalRowRMSLE>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalRowRMSLE]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:356:74: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowRMSLE]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalRowRMSLE>(); });
                                                                          ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowMAE]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalRowMAE>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalRowMAE]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:360:72: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowMAE]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalRowMAE>(); });
                                                                        ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowLogLoss]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalRowLogLoss>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalRowLogLoss]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:364:76: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalRowLogLoss]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalRowLogLoss>(); });
                                                                            ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalPoissonNegLogLik]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalPoissonNegLogLik>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalPoissonNegLogLik]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:368:82: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalPoissonNegLogLik]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalPoissonNegLogLik>(); });
                                                                                  ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalGammaDeviance]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalGammaDeviance>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalGammaDeviance]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:372:79: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalGammaDeviance]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalGammaDeviance>(); });
                                                                               ^
amalgamation/../src/metric/elementwise_metric.cu: In constructor ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalGammaNLogLik]’:
amalgamation/../src/metric/elementwise_metric.cu:315:3: error: converting to ‘xgboost::metric::ElementWiseMetricsReduction<xgboost::metric::EvalGammaNLogLik>’ from initializer list would use explicit constructor ‘xgboost::metric::ElementWiseMetricsReduction<EvalRow>::ElementWiseMetricsReduction(EvalRow) [with EvalRow = xgboost::metric::EvalGammaNLogLik]’
   EvalEWiseBase() = default;
   ^
amalgamation/../src/metric/elementwise_metric.cu: In lambda function:
amalgamation/../src/metric/elementwise_metric.cu:376:78: note: synthesized method ‘xgboost::metric::EvalEWiseBase<Policy>::EvalEWiseBase() [with Policy = xgboost::metric::EvalGammaNLogLik]’ first required here
 .set_body([](const char* param) { return new EvalEWiseBase<EvalGammaNLogLik>(); });
                                                                              ^
/usr/local/lib64/R/etc/Makeconf:174: recipe for target 'amalgamation/xgboost-all0.o' failed
make: *** [amalgamation/xgboost-all0.o] Error 1
ERROR: compilation failed for package ‘xgboost’
* removing ‘/home/<username>/R/x86_64-pc-linux-gnu-library/4.0/xgboost’

The downloaded source packages are in
        ‘/tmp/RtmppCbQFu/downloaded_packages’
Warning message:
In install.packages("xgboost") :
  installation of package ‘xgboost’ had non-zero exit status

Installs on Ubuntu 20.04 LTS.

Yes it works on Windows also, but not able to run on this Linux machine, Have gcc version 4.8.5

gcc is long outdated. I have 9.3.0

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.