Can't install R package from source under CentOS - r

I am using CentOS
-bash-4.2$ cat /etc/*release*
CentOS Linux release 7.0.1406 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CentOS Linux release 7.0.1406 (Core)
CentOS Linux release 7.0.1406 (Core)
cpe:/o:centos:centos:7
to install purrr R package from source.
I am using R CMD INSTALL command to install this package but there appears and error that I do not understand and can't overcome. Does anyone know how to resolve this issue?
-bash-4.2$ R CMD INSTALL purrr_0.1.0.tar.gz
* installing to library
* installing *source* package ‘purrr’ ...
** pakiet ‘purrr’ został pomyślnie rozpakowany oraz sumy MD5 zostały sprawdzone
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/dplyr/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
In file included from /usr/lib64/R/library/BH/include/boost/tuple/tuple.hpp:33:0,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/allocate.hpp:27,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/buckets.hpp:15,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/table.hpp:10,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/equivalent.hpp:14,
from /usr/lib64/R/library/BH/include/boost/unordered/unordered_map.hpp:17,
from /usr/lib64/R/library/BH/include/boost/unordered_map.hpp:16,
from /usr/lib64/R/library/dplyr/include/dplyr.h:32,
from RcppExports.cpp:4:
/usr/lib64/R/library/BH/include/boost/tuple/detail/tuple_basic.hpp: In function ‘typename boost::tuples::access_traits<typename boost::tuples::element<N, boost::tuples::cons<HT, TT> >::type>::const_type boost::tuples::get(const boost::tuples::cons<HT, TT>&)’:
/usr/lib64/R/library/BH/include/boost/tuple/detail/tuple_basic.hpp:228:45: warning: typedef ‘cons_element’ locally defined but not used [-Wunused-local-typedefs]
typedef BOOST_DEDUCED_TYPENAME impl::type cons_element;
^
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/dplyr/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c fast-copy.cpp -o fast-copy.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/dplyr/include" -I"/usr/lib64/R/library/BH/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c rows.cpp -o rows.o
In file included from /usr/lib64/R/library/BH/include/boost/tuple/tuple.hpp:33:0,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/allocate.hpp:27,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/buckets.hpp:15,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/table.hpp:10,
from /usr/lib64/R/library/BH/include/boost/unordered/detail/equivalent.hpp:14,
from /usr/lib64/R/library/BH/include/boost/unordered/unordered_map.hpp:17,
from /usr/lib64/R/library/BH/include/boost/unordered_map.hpp:16,
from /usr/lib64/R/library/dplyr/include/dplyr.h:32,
from rows.cpp:2:
/usr/lib64/R/library/BH/include/boost/tuple/detail/tuple_basic.hpp: In function ‘typename boost::tuples::access_traits<typename boost::tuples::element<N, boost::tuples::cons<HT, TT> >::type>::const_type boost::tuples::get(const boost::tuples::cons<HT, TT>&)’:
/usr/lib64/R/library/BH/include/boost/tuple/detail/tuple_basic.hpp:228:45: warning: typedef ‘cons_element’ locally defined but not used [-Wunused-local-typedefs]
typedef BOOST_DEDUCED_TYPENAME impl::type cons_element;
^
rows.cpp: In function ‘SEXPREC* subset_slices(const List&)’:
rows.cpp:18:3: error: ‘DataFrameSubsetVisitors’ is not a member of ‘dplyr’
dplyr::DataFrameSubsetVisitors visitors(data);
^
rows.cpp:18:34: error: expected ‘;’ before ‘visitors’
dplyr::DataFrameSubsetVisitors visitors(data);
^
rows.cpp:22:14: error: ‘visitors’ was not declared in this scope
out[i] = visitors.subset(indices[i], classes);
^
rows.cpp: In function ‘SEXPREC* by_row_impl(const List&, SEXP, SEXP, int, const Environment&)’:
rows.cpp:232:3: error: ‘DataFrameSubsetVisitors’ is not a member of ‘dplyr’
dplyr::DataFrameSubsetVisitors visitors(data);
^
rows.cpp:232:34: error: expected ‘;’ before ‘visitors’
dplyr::DataFrameSubsetVisitors visitors(data);
^
rows.cpp:237:16: error: ‘visitors’ was not declared in this scope
SEXP row = visitors.subset(IntegerVector::create(i), classes);
^
make: *** [rows.o] Błąd 1
ERROR: compilation failed for package ‘purrr’

The solution looks to be trivial https://github.com/hadley/purrr/issues/146
I had an old version of a dependent dplyr package.

Related

`ld` error when installing hdp package in R

I am try to install the hdp package by Nicola Robers using the following command in R:
devtools::install_github("nicolaroberts/hdp", build_vignettes = TRUE)
This used to get compiled and installed fine when I had the R version 3.6.2 and gcc version 9.2.1 on an (Arch) Linux machine. After updating the system to R 4.0.0 and gcc 10.1.0, the installation fails with the following message:
* installing *source* package ‘hdp’ ...
** using staged installation
** libs
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-base.c -o R-base.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-conparam.c -o R-conparam.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-dp.c -o R-dp.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-hdp.c -o R-hdp.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-hdpMultinomial_iterate.c -o R-hdpMultinomial_iterate.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-multinomial.c -o R-multinomial.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c R-utils.c -o R-utils.o
gcc -I"/usr/include/R/" -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c randutils.c -o randutils.o
gcc -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o hdp.so R-base.o R-conparam.o R-dp.o R-hdp.o R-hdpMultinomial_iterate.o R-multinomial.o R-utils.o randutils.o -L/usr/lib64/R/lib -lR
/usr/bin/ld: R-conparam.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: R-dp.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: R-hdp.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: R-hdpMultinomial_iterate.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: R-multinomial.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: R-utils.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
/usr/bin/ld: randutils.o:(.bss+0x0): multiple definition of `DEBUG'; R-base.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R//make/shlib.mk:6: hdp.so] Error 1
ERROR: compilation failed for package ‘hdp’
The individual files are compiling fine, but the linking seems to fail. Any idea on how to go about debugging what is missing?
In case someone else runs into this issue: I manged to compile it by commenting all the references to the debug printing code. I commented all lines with rdebug* and DEBUG. These functions are mainly defined in R-utils.h. It still would be nice to find a better solution. There seems to be a circular definition of the DEBUG?
I had the same issue and ended up wrangling with the C code for several hours. My knowledge in C/C++ is very limited so perhaps there are better solutions but these changes worked for me.
Defining NODEBUG in R-utils.h after #ifndef NODEBUG and adding an extern to the declaration of DEGUB per below.
#ifndef NODEBUG
#define NODEBUG
extern int DEBUG;
Added int DEBUG to R-utils.c after #include "R-utils.h".

R - 3.5.0 - Unable to install package "tm" on Linux

I am trying to install package "tm" in R 3.5.0 on a Linux machine. The installation is failing because of some G++ compiler errors. The log is as mentioned below.
> install.packages("tm")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rediris.es/src/contrib/tm_0.7-3.tar.gz'
Content type 'application/x-gzip' length 511317 bytes (499 KB)
==================================================
downloaded 499 KB
* installing *source* package ‘tm’ ...
** package ‘tm’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -std=gnu++0x -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
c RcppExports.cpp -o RcppExports.o
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
fpic -fPIC -c copy.c -o copy.o
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
fpic -fPIC -c init.c -o init.o
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
fpic -fPIC -c remove.c -o remove.o
gcc -m64 -std=gnu99 -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
fpic -fPIC -c scan.c -o scan.o
g++ -m64 -std=gnu++0x -I"/usr/include/R" -DNDEBUG -
I"/usr/lib64/R/library/BH/include" -I"/usr/lib64/R/library/Rcpp/include" -
I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -
fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -
c tdm.cpp -o tdm.o
tdm.cpp: In function ‘Rcpp::List tdm(Rcpp::StringVector, bool,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >,
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >, unsigned int, unsigned
int, unsigned int, unsigned int)’:
tdm.cpp:63: error: expected initializer before ‘:’ token
tdm.cpp:67: error: expected primary-expression before ‘return’
tdm.cpp:67: error: expected ‘;’ before ‘return’
tdm.cpp:67: error: expected primary-expression before ‘return’
tdm.cpp:67: error: expected ‘)’ before ‘return’
make: *** [tdm.o] Error 1
ERROR: compilation failed for package ‘tm’
* removing ‘/usr/lib64/R/library/tm’
The downloaded source packages are in
‘/tmp/RtmpCMwqqC/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("tm") :
installation of package ‘tm’ had non-zero exit status
I also tried to download and install the tm tar file from the cran website. That installation also gave me the same error message.

RcppArmadillo: failing to install on Ubuntu16.04

I am trying to install Rcpp on Ubuntu. Here are some environment details:
R version:3.4.0
g++ --version: Ubuntu 5.4.0-6ubuntu1~16.04.4
If I have a blank Makevars file, RcppArmadillo can be installed but with some warnings about OpenMp
g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppArmadillo.cpp -o RcppArmadillo.o
In file included from ../inst/include/armadillo:52:0,
from ../inst/include/RcppArmadilloForward.h:46,
from ../inst/include/RcppArmadillo.h:31,
from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags")
^
g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
In file included from ../inst/include/armadillo:52:0,
from ../inst/include/RcppArmadilloForward.h:46,
from ../inst/include/RcppArmadillo.h:31,
from RcppExports.cpp:4:
../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags")
^
g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fastLm.cpp -o fastLm.o
In file included from ../inst/include/armadillo:52:0,
from ../inst/include/RcppArmadilloForward.h:46,
from ../inst/include/RcppArmadillo.h:31,
from fastLm.cpp:22:
../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags")
^
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RcppArmadillo)
After I added PKG_CXXFLAGS=-std=c++11 to Makevars, I got a error message as following:
g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -std=c++11 -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppArmadillo.cpp -o RcppArmadillo.o
RcppArmadillo.cpp:22:27: fatal error: RcppArmadillo.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'RcppArmadillo.o' failed
make: *** [RcppArmadillo.o] Error 1
ERROR: compilation failed for package ‘RcppArmadillo’
* removing ‘/home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo’
* restoring previous ‘/home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo’
Warning in install.packages :
installation of package ‘RcppArmadillo’ had non-zero exit status
The wield thing is that when I tried to re-install RcppArmadillo on my mac(10.11), the same problem occurred. Could anybody enlighten me?
This is 16.10 which I have here at hone, if you wish I can repeat it at work tomorrow with 16.04:
edd#bud:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
edd#bud:~$ Rscript -e 'install.packages("RcppArmadillo")'
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppArmadillo_0.7.960.1.1.tar.gz'
Content type 'application/x-gzip' length 1115539 bytes (1.1 MB)
==================================================
downloaded 1.1 MB
* installing *source* package ‘RcppArmadillo’ ...
** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
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 ccache g++ accepts -g... yes
checking how to run the C++ preprocessor... ccache g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether ccache g++ accepts -g... (cached) yes
checking whether g++ version is sufficient... (6.2.0) yes
checking LAPACK_LIBS... system LAPACK found
checking for OpenMP... found
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloLapack.h
** libs
ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c RcppArmadillo.cpp -o RcppArmadillo.o
ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c RcppExports.cpp -o RcppExports.o
ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c fastLm.cpp -o fastLm.o
ccache g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RcppArmadillo/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (RcppArmadillo)
The downloaded source packages are in
‘/tmp/Rtmp2hQNrn/downloaded_packages’
edd#bud:~$
That I usee ccache is not material. This. Just. Works.

RcppEigen.h: No such file or directory during installation of ... RcppEigen on Centos 7

I'm not new to R but can't figure out what went wrong. I'm just trying to install RcppEigen package using install.packages('RcppEigen') and receive the above error.
The command below (issued by the installer) fails:
g++ -m64 -I/usr/include/R -DNDEBUG -I"/usr/lib64/R/library/Rcpp/include" -I/usr/local/include -std=c++11 -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RcppEigen.cpp -o RcppEigen.o
I have installed both R-Rcpp and R-Rcpp-devel version 0.12.12 from EPEL repository as well as eigen3-devel v 3.2.5 (not sure whether it is required but anyway ...)
I cloned RcppEigen from Github and tried to build in RStudio - the same error.
Makevars has PKG_CXXFLAGS = -I../inst/include but the compiler is invoked as below:
g++ -m64 -I/usr/include/R -DNDEBUG -I"/home/zer0hedge/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -std=c++11 -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RcppEigen.cpp -o RcppEigen.o
For some reason, I had PKG_CXXFLAGS defined in $HOME/.R/Makevars. It erroneously overrided PKG_CXXFLAGS in Makevars in src directory of the package and prevented compilation of C++ files

GCC in error when compiling R package on Cloudera CDH4

I am trying to install RHadoop on Cloudera's CDH4 Hadoop VM. RHadoop is a framework for using Hadoop via an R programming interface. One of the prerequisites to installing the RHadoop R package "rmr" is another R package called Rcpp, which is for calling C++ code from R. When I attempt to install the package, I get the following error. I contacted both the Rcpp and RHadoop communities and both say its a GCC problem. When I try to update or reinstall GCC, I get
"Package gcc-4.4.6-4.e16.x86_64 already installed and latest version, nothing to do." Any suggestions?
Here is the error (from the R command line).
> install.packages("Rcpp")
Installing package(s) into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://cran.csdb.cn/src/contrib/Rcpp_0.9.15.tar.gz'
Content type 'application/x-gzip' length 2119769 bytes (2.0 Mb)
opened URL
==============================
====================
downloaded 2.0 Mb
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Date.cpp -o Date.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c DateVector.cpp -o DateVector.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Datetime.cpp -o Datetime.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c DatetimeVector.cpp -o DatetimeVector.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Dimension.cpp -o Dimension.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c DottedPair.cpp -o DottedPair.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Environment.cpp -o Environment.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Evaluator.cpp -o Evaluator.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Formula.cpp -o Formula.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Function.cpp -o Function.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Language.cpp -o Language.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Module.cpp -o Module.o
{standard input}: Assembler messages:
{standard input}:10671: Warning: end of file not at end of a line; newline inserted
{standard input}:11544: Error: bad register name `%'
{standard input}:11544: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [Module.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/usr/lib64/R/library/Rcpp’
The downloaded source packages are in
‘/tmp/RtmpGdXO9h/downloaded_packages’
Updating HTML index of packages in '.Library'
Making packages.html ... done
Warning message:
In install.packages("Rcpp") :
installation of package ‘Rcpp’ had non-zero exit status
As one of the Rcpp authors, I can assure that the error is probably at your end and with either gcc (unlikely) or CDH. Rcpp gets built and rebuild a bazillion times both on CRAN (and yes there are pages summarizing the builds on CRAN and also on Debian. The package does not normally kill the compiler.
Could you be running out of ram on the box?

Resources