简体   繁体   English

Rcpp、Rtools 和 cygwin:无法安装 Rcpp

[英]Rcpp, Rtools, and cygwin: failing to install Rcpp

First try, within cygwin with R 3.1.3 installed:首先尝试,在安装了 R 3.1.3 的 cygwin 中:

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

In R:在 R 中:

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

yields an error产生错误

[...]
/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’

So I try installing Rtools 3.2.所以我尝试安装 Rtools 3.2。 As instructed for cygwin install, I don't install cygwin's dll that are included in Rtools.按照 cygwin 安装的指示,我不安装 Rtools 中包含的 cygwin dll。 Then然后

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

which, in R, yields a silent non-zero status exit when trying to do the installation在 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

Verbose mode is not more informative.详细模式并没有提供更多信息。 I searched a long time, but I am at a loss now.找了很久,现在不知所措。 Somebody has an idea?有人有想法吗? Thanks谢谢

I was getting frustrated dealing with the same errors.我对处理同样的错误感到沮丧。 In the Cygwin installation 'Select Packages' window, search for each of these libraries and install them.在 Cygwin 安装的“选择包”窗口中,搜索每个库并安装它们。 For example: pcre, lzma, bz2, ... I was finally able to compile after installing all of these.例如:pcre, lzma, bz2, ... 安装完这些我终于可以编译了。

Unless you have a specific reason to use 3.1.3, update your R to the latest version (3.2.1).除非您有使用 3.1.3 的特定原因,否则请将 R 更新到最新版本 (3.2.1)。

Many packages don't even have Windows binaries compiled for anything but the most recent R release, so 99% of the time, that solves the issue.许多软件包甚至没有为最新的 R 版本编译 Windows 二进制文件,因此在 99% 的情况下,这解决了问题。

If all you're trying to do is to install Rcpp try:如果您要做的只是安装Rcpp尝试:

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

Cygwin is not supported by R itself, and was never supported. Cygwin 不受 R 本身的支持,也从未被支持。

Edit exactly five years later: As someone just saw fit to downvote this answer once more, allow me to quote Section C.7 of the R Installation and Administration manual整整五年后编辑:因为有人认为适合再次否决这个答案,请允许我引用R 安装和管理手册的第 C.7 节

C.7 Cygwin C.7 赛格温

The 32-bit version never worked well enough to pass R's make check, and residual support from earlier experiments was removed in R 3.3.0. 32 位版本一直无法通过 R 的 make 检查,并且在 R 3.3.0 中删除了早期实验的残余支持。

The 64-bit version was never supported. 64 位版本从未被支持。

I have little more to add.我还有一点要补充。 I just re-stated what R Core says about their own software in their own manual.我只是在他们自己的手册中重申了 R Core 对他们自己的软件的看法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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