简体   繁体   English

用Rtools / MinGW编译犰狳

[英]compiling armadillo with Rtools/MinGW

I'm trying in vain to compile the armadillo linear algebra library for windows. 我试图为windows编译犰狳线性代数库是徒劳的。 Using the armadillo-4.200.0 source, I have Rtools-3.1 installed and in the path, msys from MinGW installed. 使用armadillo-4.200.0源代码,我安装了Rtools-3.1,并在路径中安装了MinGW的msys。

Because my ultimate goal is to use Rcpp and RcppArmadillo, my thought is that I need to use the same compiler for making armadillo as will be used to compile my Rcpp/RcppArmadillo files. 因为我的最终目标是使用Rcpp和RcppArmadillo,我的想法是我需要使用相同的编译器来制作犰狳,因为它将用于编译我的Rcpp / RcppArmadillo文件。 Unfortunately, when trying to compile armadillo: 不幸的是,在尝试编译犰狳时:

$ ./configure
[...snip...]
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: cl
CMake Warning at CMakeLists.txt:3 (PROJECT):
  To use the NMake generator, cmake must be run from a shell that can use the
  compiler cl from the command line.  This environment does not contain
  INCLUDE, LIB, or LIBPATH, and these must be set for the cl compiler to
  work.

CMake Error: your CXX compiler: "cl" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
[...snip...]

(I tried setting CMAKE_CXX_COMPILER to my Rtools gcc.exe with no luck.) (我尝试将CMAKE_CXX_COMPILER设置为我的Rtools gcc.exe而没有运气。)

I believe that it is looking for the visual C compiler, though the docs imply that it can be done solely with the mingw or cygwin compiler environments. 我相信它正在寻找可视化C编译器,尽管文档暗示它可以仅使用mingw或cygwin编译器环境来完成。

Either: 或者:

  1. Is there a problem with compiling the armadillo library and subsequent Rcpp code with different versions of the compiler? 使用不同版本的编译器编译armadillo库和后续Rcpp代码是否有问题? (Rtools-3.1 has gcc version 4.6.3, MinGW has gcc version 4.8.1.) (Rtools-3.1有gcc版本4.6.3,MinGW有gcc版本4.8.1。)

  2. Is there a clean method for compiling armadillo with just the Rtools collection? 有没有一个干净的方法来编译犰狳与Rtools集合?

(Win7 x64, R-3.1.0, cygwin gcc 4.8.2, rtools 3.1 with gcc 4.6.3.) (Win7 x64,R-3.1.0,cygwin gcc 4.8.2,rtools 3.1 with gcc 4.6.3。)

RcppArmadillo ships its own copy of Armadillo to avoid exactly this problem. RcppArmadillo发布了自己的Armadillo副本以避免这个问题。 As RcppArmadillpo is used from R, it can rely on R (and R's configuration) to get LAPACK, BLAS, etc pp. We don't need to run configure to use Armadillo from R, and so we don't do. 由于RcppArmadillpo是从R使用的,它可以依赖R(和R的配置)来获得LAPACK,BLAS等pp。我们不需要运行configure来使用R中的Armadillo,所以我们不这样做。

RcppArmadillo installs the usual R CMD INSTALL ... way; RcppArmadillo安装通常的R CMD INSTALL ...方式; this is tested before every release and has worked reliably. 这在每次发布之前都经过测试,并且可靠地运行。

As you say "your ultimate goal is to use Rcpp and RcppArmadillo" , you are in fact done at the R CMD INSTALL ... . 正如你所说“你的最终目标是使用Rcpp和RcppArmadillo” ,你实际上是在R CMD INSTALL ... You can replicate the step from source, and test the package -- all that should "just work". 您可以从源代码复制该步骤,并测试该程序包 - 所有应该“正常工作”。

The other thing to keep in mind is what the "Writing R Extensions" and "R Installation and Administration" manuals have to say about your compiler. 要记住的另一件事是“编写R扩展”和“R安装和管理”手册必须说明您的编译器。 As far is R is concerned, your g++ 4.8.* does not exist. 就R而言,你的g ++ 4.8。*不存在。 Only the Rtools version matters, or you get into non-standard land real quick. 只有Rtools版本很重要,否则你很快就会进入非标准的土地。

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

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