简体   繁体   English

使用Rcpp安装R软件包是否需要Rtools(Windows)

[英]Does installing an R package with Rcpp require Rtools (Windows)

I am making an R package with Rcpp. 我正在用Rcpp制作R包。 It works fine on my machine which has Rtools installed. 它在安装了Rtools的机器上可以正常工作。 But recently, I tried to install my package locally on a different machine (Windows) and got a compiling error. 但是最近,我尝试将软件包本地安装在其他计算机(Windows)上,并出现编译错误。 The reason was that on that machine there was no g++ compiler (for Windows, g++ is provided with Rtools). 原因是在该计算机上没有g ++编译器(对于Windows,Rtools提供了g ++)。 After installing Rtools, it worked just fine. 安装Rtools后,它工作正常。

So the question is, if I upload it to CRAN, does it still requires users to install Rtools by hand? 所以问题是,如果我将其上传到CRAN,它是否仍然需要用户手动安装Rtools? Or does the function install.package() detect and install Rtools for them? 还是功能install.package()为它们检测并安装了Rtools?

Also, if you guys know some packages written with Rcpp, please let me know. 另外,如果你们知道一些用Rcpp编写的软件包,请告诉我。 I'd like to take a look how it works. 我想看看它是如何工作的。

So the question is, if I upload it to CRAN, does it still requires users to install Rtools by hand? 所以问题是,如果我将其上传到CRAN,它是否仍然需要用户手动安装Rtools?

No. 没有。

Or does the function install.package() detect and install Rtools for them? 还是功能install.package()为它们检测并安装了Rtools?

No. 没有。

What happens is that CRAN builds pre-compiled binary files that can be installed by Windows and MacOS users without the need for compilers and related tools. 发生的事情是CRAN生成了预编译的二进制文件,Windows和MacOS用户可以安装这些文件,而无需编译器和相关工具。

Also, if you guys know some packages written with Rcpp, please let me know. 另外,如果你们知道一些用Rcpp编写的软件包,请告诉我。 I'd like to take a look how it works. 我想看看它是如何工作的。

rr <- devtools::revdep("Rcpp")
length(rr) ## 907

or see the Rcpp page on CRAN . 或参见CRAN上Rcpp页面

Users , eg people who download it via install.package() , are actually downloading a "compiled" version of the packaged called a binary that is maintained by CRAN. 用户 (例如,通过install.package()下载它的人install.package()实际上正在下载打包的“编译”版本,称为CRAN维护的二进制文件。 They will only ever need a copy of R. 他们只需要R的副本。

On the other hand, Developers , eg people who are creating it, require development tools that are system specific. 另一方面, 开发人员 (例如创建它的人)需要特定于系统的开发工具。 For those on the Windows platform , they must have a local install of Rtools on their machine. 对于Windows平台上的用户 ,他们必须在计算机上本地安装Rtools For developers on macOS , they must have their own copies of gfortran binaries and xcode developer line tools . 对于macOS上的 开发人员 ,他们必须拥有自己的gfortran二进制文件和xcode开发人员工具行

Lastly, there are many such Rcpp packages available to look to for inspiration... 最后,有很多这样的Rcpp软件包可用于寻找灵感...

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

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