Rcpp,Rtools和cygwin:未能安装Rcpp

时间:2015-07-14 15:10:56

标签: r installation cygwin rcpp

首先尝试在安装了R 3.1.3的cygwin中:

>PATH=/usr/local/bin:/usr/bin

在R:

>install.packages("Rcpp",repos="http://cran.us.r-project.org")

产生错误

[...]
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lpcre
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -llzma
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lbz2
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lz
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -liconv
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -licuuc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -licui18n
collect2: error: ld returned 1 exit status
/usr/lib/R/share/make/shlib.mk:6: recipe for target 'Rcpp.dll' failed
make: *** [Rcpp.dll] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/usr/lib/R/site-library/Rcpp’

所以我尝试安装Rtools 3.2。按照cygwin安装的指示,我不安装包含在Rtools中的cygwin的dll。然后

>PATH=/cygdrive/c/Rtools/bin:/cygdrive/c/Rtools/gcc-4.6.3/bin:$PATH

,在R中,在尝试进行安装时会产生静默的非零状态退出

Installing package into ‘/usr/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/Rcpp_0.11.6.tar.gz'
Content type 'application/x-gzip' length 2352221 bytes (2.2 MB)
opened URL
==================================================
downloaded 2.2 MB


The downloaded source packages are in
        ‘/tmp/Rtmp71eoxd/downloaded_packages’
Warning message:
In install.packages("Rcpp", repos = "http://cran.us.r-project.org") :
  installation of package ‘Rcpp’ had non-zero exit status

详细模式信息量不大。我搜索了很长时间,但我现在不知所措。有人有想法吗?感谢

3 个答案:

答案 0 :(得分:3)

我对处理同样的错误感到沮丧。在Cygwin安装'选择包'窗口,搜索每个库并安装它们。例如:pcre,lzma,bz2,...我在安装所有这些之后终于能够编译了。

答案 1 :(得分:0)

R本身不支持Cygwin,并且从不支持。

答案 2 :(得分:-1)

除非您有特殊原因要使用3.1.3,否则请将您的R更新到最新版本(3.2.1)。

许多软件包甚至没有编译Windows二进制文件,除了最新的R版本,因此有99%的时间可以解决这个问题。

如果你要做的就是安装Rcpp,请尝试:

install.packages("Rcpp", type='source')