简体   繁体   中英

installation of package ‘raster’ had non-zero exit status

i'm trying install the package "Raster", but appear the error installation of package 'raster' had non-zero exit status.

I have read in other sites, without success I thank you in advance

I detail below the process and the errors.

install.packages("raster")
Installing package into ‘/home/hectorirc/R/x86_64-pc-linux-gnu- 

library/3.4' (as 'lib' is unspecified) also installing the dependencies 'sp', 'Rcpp'

probando la URL 'https://cloud.r-project.org/src/contrib/sp_1.3-1.tar.gz'
Content type 'application/x-gzip' length 1133621 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

probando la URL 'https://cloud.r-project.org/src/contrib/Rcpp_0.12.17.tar.gz'
Content type 'application/x-gzip' length 3766351 bytes (3.6 MB)
==================================================
downloaded 3.6 MB

probando la URL 'https://cloud.r-project.org/src/contrib/raster_2.6-7.tar.gz'
Content type 'application/x-gzip' length 1080946 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

* installing *source* package ‘sp’ ...
** package ‘sp’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Rcentroid.c -o Rcentroid.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c gcdist.c -o gcdist.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c pip.c -o pip.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c pip2.c -o pip2.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c sp_xports.c -o sp_xports.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c surfaceArea.c -o surfaceArea.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c zerodist.c -o zerodist.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o sp.so Rcentroid.o gcdist.o init.o pip.o pip2.o sp_xports.o surfaceArea.o zerodist.o -L/usr/lib/R/lib -lR
/bin/bash: línea 2: g++: no se encontró la orden
/usr/share/R/share/make/shlib.mk:6: recipe for target 'sp.so' failed
make: *** [sp.so] Error 127
ERROR: compilation failed for package ‘sp’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/sp’
Warning in install.packages :
  installation of package ‘sp’ had non-zero exit status
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++  -I/usr/share/R/include -DNDEBUG -I../inst/include/     -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c Date.cpp -o Date.o
/bin/bash: g++: no se encontró la orden
/usr/lib/R/etc/Makeconf:168: recipe for target 'Date.o' failed
make: *** [Date.o] Error 127
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/Rcpp’
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status
ERROR: dependencies ‘sp’, ‘Rcpp’ are not available for package ‘raster’
* removing ‘/home/hectorirc/R/x86_64-pc-linux-gnu-library/3.4/raster’
Warning in install.packages :
  installation of package ‘raster’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpRSrx6A/downloaded_packages’

thanks :)

I think the problem is not with R but missing build tools. You need to install the g++ compiler, which . On Ubuntu you would just (in a command line shell, not in R):

sudo apt-get install build-essential

assuming you have permissions to install things;...but from a quick web search it may be a bit more complicated with Linux Mint.

For Ubuntu 18.04 and maybe other Linux distributions if the above doesn't work for you try:

sudo apt install r-cran-raster

R can then use raster to build the libaries.

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