安装软件包“ raster”的退出状态为非零

时间:2018-07-03 03:58:52

标签: r linux runtime-error warnings

我正在尝试安装软件包“ Raster”,但出现错误显示软件包“ raster”的退出状态为非零。

我在其他网站上阅读过,但没有成功 我先谢谢你

我在下面详细介绍了过程和错误。

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

库/3.4”    (因为未指定“ lib”)     还安装了依赖项“ 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’

谢谢:)

2 个答案:

答案 0 :(得分:1)

我认为问题不在于R,而是缺少构建工具。您需要安装g ++编译器。在Ubuntu上,您只需(在命令行shell中,而不在R中):

sudo apt-get install build-essential

假设您有权安装东西; ...但是通过快速的网络搜索,使用Linux Mint可能会更加复杂。

答案 1 :(得分:0)

对于 Ubuntu 18.04 和其他 Linux 发行版,如果上述方法对您不起作用,请尝试:

sudo apt install r-cran-raster

R 然后可以使用 raster 来构建库。