简体   繁体   中英

rcpp compiling error when installing R 3.5 packages (ubuntu 16.04)

I'm unable to install tidyverse or devtools, and I'm getting this error:

/usr/lib/R/etc/Makeconf:172: recipe for target 'RcppExports.o' failed
make: *** [RcppExports.o] Error 1

For example, these are the results for install.packages("tidyverse", dependencies = TRUE):

 ^
/usr/lib/R/etc/Makeconf:172: recipe for target 'RcppExports.o' failed
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘xml2’
* removing ‘/usr/local/lib/R/site-library/xml2’
ERROR: dependency ‘xml2’ is not available for package ‘rvest’
* removing ‘/usr/local/lib/R/site-library/rvest’
ERROR: dependencies ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
* removing ‘/usr/local/lib/R/site-library/tidyverse’

My R version:

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          5.3                         
year           2019                        
month          03                          
day            11                          
svn rev        76217                       
language       R                           
version.string R version 3.5.3 (2019-03-11)
nickname       Great Truth       

I've tried installing each individual dependency, but get the same error each time (sometimes with a different constellation of dependencies: rvest,roxygen2,rversions,lintr,etc.). I've also tried uninstalling Rcpp and reinstalling it. I've tried updating my packages (update.packages(checkBuilt=TRUE, ask=FALSE). I haven't messed with any other settings. This is running on Ubuntu 16.04 with 2GB of RAM. Could it be a memory issue? Do I need to start from scratch and reinstall?

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial
              total        used        free      shared  buff/cache   available
Mem:           1971         932         653          16         385         830
Swap:           999         518         481

ADDED INFO: I saw it suggested elsewhere to try installing the latest version of xml2 from github: remotes::install_github("hadley/xml2")

This is the error (similar to the one before) I got when doing that:

  ^
   /usr/lib/R/etc/Makeconf:172: recipe for target 'RcppExports.o' failed
   make: *** [RcppExports.o] Error 1
   ERROR: compilation failed for package ‘xml2’
─  removing ‘/tmp/RtmpNcUpLL/Rinst1bbc679e28bc/xml2’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'xml2' from GitHub:
  System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
>                  from RcppExports.cpp:4:
> /usr/include/unicode/ucnv.h:585:1: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
>  U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
>  ^
> /usr/lib/R/etc/Makeconf:172: recipe for target 'RcppExports.o' failed
> make: *** [RcppExports.o] Error 1
> ERROR: compilation failed for package ‘xml2’
> * removing ‘/tmp/RtmpNcUpLL/Rinst1bbc679e28bc/xml2’
>       -----------------------------------
> ERROR: package installation failed
> 

Results from R CMD config --all


CC = gcc -std=gnu99
CFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CPICFLAGS = -fpic
CPP = gcc -std=gnu99 -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXXPICFLAGS = -fpic
CXX11 = g++
CXX11STD = -std=gnu++11
CXX11FLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXX11PICFLAGS = -fpic
CXX14 = g++
CXX14STD = -std=gnu++14
CXX14FLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXX14PICFLAGS = -fpic
CXX98 = g++
CXX98STD = -std=gnu++98
CXX98FLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXX98PICFLAGS = -fpic
CXX17 =
CXX17STD =
CXX17FLAGS =
CXX17PICFLAGS =
CXX1X = g++
CXX1XSTD = -std=gnu++11
CXX1XFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXX1XPICFLAGS = -fpic
DYLIB_EXT = .so
DYLIB_LD = gcc -std=gnu99
DYLIB_LDFLAGS = -shared -fopenmp
F77 = gfortran
FFLAGS = -g -O2 -fstack-protector-strong
FPICFLAGS = -fpic
FLIBS = -lgfortran -lm -lquadmath
SAFE_FFLAGS = -g -O2 -fstack-protector-strong -msse2 -mfpmath=sse
FC = gfortran
FCFLAGS = -g -O2 -fstack-protector-strong
FCPICFLAGS = -fpic
OBJC =
OBJCFLAGS =
JAVA = /usr/lib/jvm/default-java/jre/bin/java
JAVAC = /usr/lib/jvm/default-java/bin/javac
JAVAH = /usr/lib/jvm/default-java/bin/javah
JAR = /usr/lib/jvm/default-java/bin/jar
JAVA_HOME = /usr/lib/jvm/default-java
JAVA_LIBS = -L/usr/lib/jvm/default-java/jre/lib/amd64/server -ljvm
JAVA_CPPFLAGS = -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
LDFLAGS = -Wl,-Bsymbolic-functions -Wl,-z,relro
SHLIB_CFLAGS =
SHLIB_CXXLD = g++
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX98LD = g++ -std=gnu++98
SHLIB_CXX98LDFLAGS = -shared
SHLIB_CXX11LD = g++ -std=gnu++11
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = g++ -std=gnu++14
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD =
SHLIB_CXX17LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = gcc -std=gnu99
SHLIB_LDFLAGS = -shared
SHLIB_FCLD = gfortran
SHLIB_FCLDFLAGS = -shared
SHLIB_CXX1XLD = g++ -std=gnu++11
SHLIB_CXX1XLDFLAGS = -shared
TCLTK_CPPFLAGS = -I/usr/include/tcl8.6 -I/usr/include/tcl8.6
TCLTK_LIBS = -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -L/usr/lib/x86_64-linux-gnu -ltk8.6 -lX11 -lXss -lXext
BLAS_LIBS = -lblas
LAPACK_LIBS = -llapack
MAKE = make
LIBnn = lib
LOCAL_SOFT =
COMPILED_BY =

I was eventually able to install xml2 into a different library directory by doing this at the command line:

sudo apt-get install r-cran-xml2 

This installed xml2 into the /usr/lib/R/site-library directory, whereas using R and install.packages installs by default into the /usr/local/lib/R/site-library directory, which is what wasn't working.

Once xml2 was installed, it allowed me to install devtools and kinda-sorta solved my issue for the moment, but I still get the rcpp error if I try to install tidyverse or several other packages using sudo R-->install.packages("xml2"). I'd be interested in finding out what's going on if anyone ever happens upon this and has any insight!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM