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

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.

Related

Rgdal package install: projects.h: No such file or directory (error)

I'm trying to install Rgdal package on my local server (no connected to internet). when I ran install.packages("rgdal_1.2-15.tar.gz","/usr/lib64/R/library/",repos=NULL) I got an error inverser.c:4:22: error: projects.h: No such file or directory
this is the out put of install process:
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.2-15
checking for /usr/bin/svnversion... no
configure: svn revision: 691
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.8.1
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/pcs.csv readable... yes
configure: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -I/usr/include/gdal
checking proj_api.h presence and usability... yes
checking PROJ.4 version: ... 4.8.0
checking PROJ.4: epsg found and readable... yes
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags: -I/usr/include/gdal
configure: Package LIBS: -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c OGR_write.cpp -o OGR_write.o
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal-bindings.cpp -o gdal-bindings.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/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/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/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 inverser.c -o inverser.o
inverser.c:4:22: error: projects.h: No such file or directory
inverser.c:6: error: expected ‘)’ before ‘*’ token
make: *** [inverser.o] Error 1
ERROR: compilation failed for package ‘rgdal’
* removing ‘/usr/lib64/R/library/rgdal’
Warning message:
In install.packages("/data/ZUY10/Repo/R/rgdal_1.2-15.tar.gz", "/usr/lib64/R/library/", :
installation of package ‘/data/ZUY10/Repo/R/rgdal_1.2-15.tar.gz’ had non-zero exit status
What I did before this step:
Since my server is local, I had to install all package "dependencies" manually in my local server, So I installed like 30 packages manually which PROJ.4 and Gdal are principal as you can see here.
What do I miss here to install the RGDAL PACKAGE?
The header projects.h comes from PROJ.4. Where is that header file located on your system? You can pass this location to the configure script via --with-proj-include=DIR, i.e.
install.packages("rgdal_1.2-15.tar.gz",
"/usr/lib64/R/library/",
repos=NULL,
configure.args="--with-proj-include=DIR")
A check for projects.h being found has been added to rgdal only recently.
I have also faced above issue on RHEL7.7 upon doing multiple search. I resolved it as below:
#cd /opt
#wget http://download.osgeo.org/gdal/2.0.1/gdal-2.0.1.tar.gz
#./configure
#make
#make install
#echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf
#ldconfig
#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64
Hope this helps.

Understanding where my R libraries are being installed to on EC2 instance (Amazon Linux AMI)

I am trying to create an Amazon Linux AMI EC2 instance that I can save as my own AMI, with all of the softwares installed already so I don't have to redo all of this stuff everytime I need a new EC2 instance.
One thing I'm trying to understand is where all of my R libraries are being installed to... When I install a library, I receive the following:
[root#ip-myip] R -e "install.packages('jsonlite', repos='http://cran.rstudio.com/')"
R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> install.packages('jsonlite', repos='http://cran.rstudio.com/')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/jsonlite_1.5.tar.gz'
Content type 'application/x-gzip' length 1096810 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
* installing *source* package ‘jsonlite’ ...
** package ‘jsonlite’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 base64.c -o base64.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 collapse_array.c -o collapse_array.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 collapse_object.c -o collapse_object.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 collapse_pretty.c -o collapse_pretty.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 escape_chars.c -o escape_chars.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 integer64_to_na.c -o integer64_to_na.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 is_datelist.c -o is_datelist.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 is_recordlist.c -o is_recordlist.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 is_scalarlist.c -o is_scalarlist.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 modp_numtoa.c -o modp_numtoa.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 null_to_na.c -o null_to_na.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 num_to_char.c -o num_to_char.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 parse.c -o parse.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 prettify.c -o prettify.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 push_parser.c -o push_parser.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 r-base64.c -o r-base64.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 register.c -o register.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 row_collapse.c -o row_collapse.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 transpose_list.c -o transpose_list.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 validate.c -o validate.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl.c -o yajl/yajl.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_alloc.c -o yajl/yajl_alloc.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_buf.c -o yajl/yajl_buf.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_encode.c -o yajl/yajl_encode.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_gen.c -o yajl/yajl_gen.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_lex.c -o yajl/yajl_lex.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_parser.c -o yajl/yajl_parser.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -Iyajl/api -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 yajl/yajl_tree.c -o yajl/yajl_tree.o
ar rcs libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o jsonlite.so base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -L. -lstatyajl -L/usr/lib64/R/lib -lR
installing to /usr/lib64/R/library/jsonlite/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘jsonlite’
finding HTML links ... done
base64 html
flatten html
fromJSON html
prettify html
rbind_pages html
Rd warning: /tmp/RtmpZ3IcD8/R.INSTALL21106d208413/jsonlite/man/rbind_pages.Rd:22: missing file link ‘rbind’
read_json html
serializeJSON html
stream_in html
unbox html
validate html
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (jsonlite)
Making 'packages.html' ... done
The downloaded source packages are in
‘/tmp/RtmpRRGy3s/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
>
>
So the answer seems obvious... The downloaded source packages are in ‘/tmp/RtmpRRGy3s/downloaded_packages’ Wonderful! However, when I cd into my /tmp directory, I see the following...
[root#ip-myip /]# cd tmp
[root#ip-myip tmp]# ls
hsperfdata_root rstudio-rsession Rtmp49pRek Rtmp9cGn9Z RtmpzATaBO Rtmpzmgmqv
Although similar, none of those directories match the RtmpRRGy3s from the install command. Also, all of the other folders starting with Rtmp... are empty!
I like trying to understand these types of problems, and since I'll be using this AMI over and over again, I'd really like to know where my R libraries are being installed. Any help is appreciated:
EDIT - here is my home directory on my EC2 instance:
[root#ip-myip /]# ls
bin cgroup etc lib local media opt root sbin srv tmp var
boot dev home lib64 lost+found mnt proc run selinux sys usr
and here's what's hidden in my root directory:
cd root
ls -a
. .bash_history .bash_profile .cshrc .RData .tcshrc
.. .bash_logout .bashrc .pki .ssh .viminfo

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

Can't install R package from source under CentOS

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.

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