Rstudio 安装包问题

Rstudio Install Packages Issue

每当我尝试将软件包安装到 rstudio 中时,我总是会收到如下所示的错误消息:

install.packages('MARSS')
Installing package into ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependency ‘KFAS’

--2018-04-27 15:03:51--  https://cran.rstudio.com/src/contrib/KFAS_1.3.1.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 52.84.28.162
Connecting to cran.rstudio.com (cran.rstudio.com)|52.84.28.162|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 626101 (611K) [application/x-gzip]
Saving to: ‘/tmp/RtmpnXKPTc/downloaded_packages/KFAS_1.3.1.tar.gz’

     0K .......... .......... .......... .......... ..........  8% 2.42M 0s
    50K .......... .......... .......... .......... .......... 16% 2.50M 0s
   100K .......... .......... .......... .......... .......... 24% 2.43M 0s
   150K .......... .......... .......... .......... .......... 32% 2.52M 0s
   200K .......... .......... .......... .......... .......... 40% 2.47M 0s
   250K .......... .......... .......... .......... .......... 49% 2.35M 0s
   300K .......... .......... .......... .......... .......... 57% 2.65M 0s
   350K .......... .......... .......... .......... .......... 65% 1.94M 0s
   400K .......... .......... .......... .......... .......... 73% 2.55M 0s
   450K .......... .......... .......... .......... .......... 81% 2.53M 0s
   500K .......... .......... .......... .......... .......... 89% 2.62M 0s
   550K .......... .......... .......... .......... .......... 98% 2.66M 0s
   600K .......... .                                          100% 7.47M=0.2s

2018-04-27 15:03:51 (2.48 MB/s) - ‘/tmp/RtmpnXKPTc/downloaded_packages/KFAS_1.3.1.tar.gz’ saved [626101/626101]

--2018-04-27 15:03:51--  https://cran.rstudio.com/src/contrib/MARSS_3.10.8.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 52.84.28.162
Connecting to cran.rstudio.com (cran.rstudio.com)|52.84.28.162|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2717348 (2.6M) [application/x-gzip]
Saving to: ‘/tmp/RtmpnXKPTc/downloaded_packages/MARSS_3.10.8.tar.gz’

     0K .......... .......... .......... .......... ..........  1% 2.42M 1s
    50K .......... .......... .......... .......... ..........  3% 2.57M 1s
   100K .......... .......... .......... .......... ..........  5% 2.51M 1s
   150K .......... .......... .......... .......... ..........  7% 2.56M 1s
   200K .......... .......... .......... .......... ..........  9% 2.57M 1s
   250K .......... .......... .......... .......... .......... 11% 2.56M 1s
   300K .......... .......... .......... .......... .......... 13% 2.30M 1s
   350K .......... .......... .......... .......... .......... 15% 1.86M 1s
   400K .......... .......... .......... .......... .......... 16% 2.51M 1s
   450K .......... .......... .......... .......... .......... 18% 2.61M 1s
   500K .......... .......... .......... .......... .......... 20% 2.58M 1s
   550K .......... .......... .......... .......... .......... 22% 2.35M 1s
   600K .......... .......... .......... .......... .......... 24% 2.52M 1s
   650K .......... .......... .......... .......... .......... 26% 2.57M 1s
   700K .......... .......... .......... .......... .......... 28% 2.44M 1s
   750K .......... .......... .......... .......... .......... 30% 1.95M 1s
   800K .......... .......... .......... .......... .......... 32% 2.60M 1s
   850K .......... .......... .......... .......... .......... 33% 2.32M 1s
   900K .......... .......... .......... .......... .......... 35% 2.44M 1s
   950K .......... .......... .......... .......... .......... 37% 2.48M 1s
  1000K .......... .......... .......... .......... .......... 39% 2.41M 1s
  1050K .......... .......... .......... .......... .......... 41% 2.55M 1s
  1100K .......... .......... .......... .......... .......... 43% 2.34M 1s
  1150K .......... .......... .......... .......... .......... 45% 1.91M 1s
  1200K .......... .......... .......... .......... .......... 47% 2.69M 1s
  1250K .......... .......... .......... .......... .......... 48% 2.66M 1s
  1300K .......... .......... .......... .......... .......... 50% 2.39M 1s
  1350K .......... .......... .......... .......... .......... 52% 2.35M 1s
  1400K .......... .......... .......... .......... .......... 54% 2.53M 0s
  1450K .......... .......... .......... .......... .......... 56% 2.51M 0s
  1500K .......... .......... .......... .......... .......... 58% 2.55M 0s
  1550K .......... .......... .......... .......... .......... 60% 1.91M 0s
  1600K .......... .......... .......... .......... .......... 62% 2.44M 0s
  1650K .......... .......... .......... .......... .......... 64% 2.44M 0s
  1700K .......... .......... .......... .......... .......... 65% 2.62M 0s
  1750K .......... .......... .......... .......... .......... 67% 2.29M 0s
  1800K .......... .......... .......... .......... .......... 69% 2.56M 0s
  1850K .......... .......... .......... .......... .......... 71%  618K 0s
  1900K .......... .......... .......... .......... .......... 73% 8.96M 0s
  1950K .......... .......... .......... .......... .......... 75% 1.44M 0s
  2000K .......... .......... .......... .......... .......... 77% 8.95M 0s
  2050K .......... .......... .......... .......... .......... 79%  149M 0s
  2100K .......... .......... .......... .......... .......... 81% 3.60M 0s
  2150K .......... .......... .......... .......... .......... 82% 2.19M 0s
  2200K .......... .......... .......... .......... .......... 84% 1.65M 0s
  2250K .......... .......... .......... .......... .......... 86% 2.13M 0s
  2300K .......... .......... .......... .......... .......... 88% 2.10M 0s
  2350K .......... .......... .......... .......... .......... 90% 1.54M 0s
  2400K .......... .......... .......... .......... .......... 92% 2.21M 0s
  2450K .......... .......... .......... .......... .......... 94% 2.04M 0s
  2500K .......... .......... .......... .......... .......... 96% 2.24M 0s
  2550K .......... .......... .......... .......... .......... 97% 2.55M 0s
  2600K .......... .......... .......... .......... .......... 99% 2.60M 0s
  2650K ...                                                   100% 6981G=1.1s

2018-04-27 15:03:53 (2.30 MB/s) - ‘/tmp/RtmpnXKPTc/downloaded_packages/MARSS_3.10.8.tar.gz’ saved [2717348/2717348]

* installing *source* package ‘KFAS’ ...
** package ‘KFAS’ successfully unpacked and MD5 sums checked
** libs
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  approx.f95 -o approx.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  approxloop.f95 -o approxloop.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  artransform.f95 -o artransform.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 cdistwrap.c -o cdistwrap.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  covmeanw.f95 -o covmeanw.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  filter1step.f95 -o filter1step.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  filter1stepnovar.f95 -o filter1stepnovar.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  filtersimfast.f95 -o filtersimfast.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  gloglik.f95 -o gloglik.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  gsmoothall.f95 -o gsmoothall.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
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  isample.f95 -o isample.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  isamplefilter.f95 -o isamplefilter.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  kfilter.f95 -o kfilter.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  kfilter2.f95 -o kfilter2.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  kfstheta.f95 -o kfstheta.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ldl.f95 -o ldl.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ldlssm.f95 -o ldlssm.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  marginalxx.f95 -o marginalxx.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  mvfilter.f95 -o mvfilter.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ngfilter.f95 -o ngfilter.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ngloglik.f95 -o ngloglik.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ngsmooth.f95 -o ngsmooth.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  predict.f95 -o predict.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  ptheta.f95 -o ptheta.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  pytheta.f95 -o pytheta.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  simfilter.f95 -o simfilter.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  simgaussian.f95 -o simgaussian.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  simgaussianuncond.f95 -o simgaussianuncond.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  smoothonestep.f95 -o smoothonestep.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  smoothsim.f95 -o smoothsim.o
gfortran  -fpic -g -O2 -fstack-protector-strong  -c  smoothsimfast.f95 -o smoothsimfast.o
gfortran -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o KFAS.so approx.o approxloop.o artransform.o cdistwrap.o covmeanw.o filter1step.o filter1stepnovar.o filtersimfast.o gloglik.o gsmoothall.o init.o isample.o isamplefilter.o kfilter.o kfilter2.o kfstheta.o ldl.o ldlssm.o marginalxx.o mvfilter.o ngfilter.o ngloglik.o ngsmooth.o predict.o ptheta.o pytheta.o simfilter.o simgaussian.o simgaussianuncond.o smoothonestep.o smoothsim.o smoothsimfast.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'KFAS.so' failed
make: *** [KFAS.so] Error 1
ERROR: compilation failed for package ‘KFAS’
* removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.2/KFAS’
Warning in install.packages :
  installation of package ‘KFAS’ had non-zero exit status
ERROR: dependency ‘KFAS’ is not available for package ‘MARSS’
* removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.2/MARSS’
Warning in install.packages :
  installation of package ‘MARSS’ had non-zero exit status

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

我已经尝试完成我在 Stack-Exchange 中可以找到的所有内容,但似乎没有任何效果。我在 Linux Mint 设备上,我是来自 root 的 运行 Rstudio。我认为问题可能出在

/usr/bin/ld: cannot find -llapack

/usr/bin/ld: cannot find -lblas

出现在代码中间的部分,但它可能不是,如果是,我不知道如何修复它。需要明确的是,当我尝试安装其他软件包时也会发生类似的事情,所以我认为问题一定来自我的 Rstudio 副本或 Linux.

评论中的讨论总结:如果要从源安装包,则需要有相关的开发包可用。在包括 Ubuntu 和 Mint 的 Debian(派生)系统上,可以通过

安装一组必要的此类软件包
sudo apt-get install r-base-dev

对于单个包,可能需要额外的开发包,但这里不是这种情况。