首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Windows下编译RInside示例的问题

在Windows下编译RInside示例的问题
EN

Stack Overflow用户
提问于 2011-04-13 13:29:35
回答 3查看 2.6K关注 0票数 8

我试图在工作时设置RInside,在那里我们被迫使用Windows环境。

我已经安装了RTools并下载了一个来自CRAN的RInside二进制

我的R安装位于c:\R\R-2.12.2中,所以没有空格文件夹的问题。

我已经在RInside R中安装了Rcpp和包。

我执行下载的Makefile.win二进制文件中包含的以下makefile RInside

代码语言:javascript
复制
## -*- mode: makefile; tab-width: 8; -*-
##
## Simple Makefile
##
## TODO:
##  proper configure for non-Debian file locations,   [ Done ]
##  allow RHOME to be set for non-default R etc

## comment this out if you need a different version of R,
## and set set R_HOME accordingly as an environment variable
R_HOME :=       'cygdrive/c/R/R-2.12.2'

sources :=      $(wildcard *.cpp)
programs :=         $(sources:.cpp=)

## include headers and libraries for R
RCPPFLAGS :=        $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=         $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=        $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=      $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## include headers and libraries for Rcpp interface classes
RCPPINCL :=         $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --    slave)
RCPPLIBS :=         $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## include headers and libraries for RInside embedding classes
RINSIDEINCL :=      $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS :=      $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
CXX :=          $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS :=         -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=         $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell     $(R_HOME)/bin/R     CMD config CXXFLAGS)
LDFLAGS =       -s
LDLIBS :=       $(RLDFLAGS) $(RBLAS) $(RLAPACK) $(RINSIDELIBS) $(RCPPLIBS) 
CC :=           $(shell $(R_HOME)/bin/R CMD config CXX)

all :           $(programs)

clean:
        rm -vf $(programs)

用命令

代码语言:javascript
复制
make -f Makefile.win

要尝试构建,请参见包括的标准示例

但是,我得到以下错误:

代码语言:javascript
复制
C:\RInside_0.2.3\RInside\examples\standard>make -f Makefile.win
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
Wall  -s  rinside_callbacks0.cpp        -o rinside_callbacks0
make: Wall: Command not found
make: [rinside_callbacks0] Error 127 (ignored)
Wall  -s  rinside_module_sample0.cpp        -o rinside_module_sample0
make: Wall: Command not found
make: [rinside_module_sample0] Error 127 (ignored)
Wall  -s  rinside_sample0.cpp        -o rinside_sample0
make: Wall: Command not found
make: [rinside_sample0] Error 127 (ignored)
Wall  -s  rinside_sample1.cpp        -o rinside_sample1
make: Wall: Command not found
make: [rinside_sample1] Error 127 (ignored)
Wall  -s  rinside_sample2.cpp        -o rinside_sample2
make: Wall: Command not found
make: [rinside_sample2] Error 127 (ignored)
Wall  -s  rinside_sample3.cpp        -o rinside_sample3
make: Wall: Command not found
make: [rinside_sample3] Error 127 (ignored)
Wall  -s  rinside_sample4.cpp        -o rinside_sample4
make: Wall: Command not found
make: [rinside_sample4] Error 127 (ignored)
Wall  -s  rinside_sample5.cpp        -o rinside_sample5
make: Wall: Command not found
make: [rinside_sample5] Error 127 (ignored)
Wall  -s  rinside_sample6.cpp        -o rinside_sample6
make: Wall: Command not found
make: [rinside_sample6] Error 127 (ignored)
Wall  -s  rinside_sample7.cpp        -o rinside_sample7
make: Wall: Command not found
make: [rinside_sample7] Error 127 (ignored)
Wall  -s  rinside_sample8.cpp        -o rinside_sample8
make: Wall: Command not found
make: [rinside_sample8] Error 127 (ignored)
Wall  -s  rinside_sample9.cpp        -o rinside_sample9
make: Wall: Command not found
make: [rinside_sample9] Error 127 (ignored)
Wall  -s  rinside_test0.cpp        -o rinside_test0
make: Wall: Command not found
make: [rinside_test0] Error 127 (ignored)
Wall  -s  rinside_test1.cpp        -o rinside_test1
make: Wall: Command not found
make: [rinside_test1] Error 127 (ignored)

我为R_HOME尝试过不同的路径,但我怀疑自己是否有能力找到正确的路径。我是新手,所以错误输出没有多大帮助。

希望有人有一些宝贵的洞察力来分享!

提前谢谢你,

克里斯蒂安

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2011-04-13 14:14:04

我在工作上也有类似的设置,所以我试了一下。我可以在指定R_LIBS_SITE之后构建这些示例。注意,它必须是Windows路径,而不是Cygwin路径!

代码语言:javascript
复制
export R_LIBS_SITE=c:/R/site-library
票数 6
EN

Stack Overflow用户

发布于 2011-04-13 13:45:16

你在这里似乎有两个截然不同的问题:

  1. 您的$PATH可能已关闭,或者正如乔希所暗示的,您的$R_HOME作业是错误的。如果make确实是Rtools中的二进制文件,并且您指定的路径是正确的,那么构建就成功了。这是在Windows上构建R包的一般规则:非常努力地遵循手册,它就能工作了。
  2. RInside在Windows上坏了,对不起。它会建立起来,你会得到分段故障。罗曼和我在文件中清楚地说明了这一点。

由于Romain和我几乎都只在OS和Linux上工作,所以我们希望能够帮助调试。这应该是可行的,但是它可能需要一些认真的意愿来学习R内部的东西,因为在内存子系统中会出现问题。很明显,在开放源码软件上,他们的名字里没有一个X。

更新于2011年12月8日,:RInside 0.2.5,截至今天,在CRAN上恢复Windows功能--使用另一条注释中的修复詹姆斯注释。

票数 6
EN

Stack Overflow用户

发布于 2011-11-28 00:57:00

今天,我花了一点时间研究windows版本的RInside的错误。我相信我发现了这样的漏洞:

在RInside::initialize(……)中但是,structRStart结构现在需要在窗口中填充额外的字段,如R\src\gnuwin32 32\Embedded.c中的Rf_initEmbeddedR()所示。

代码语言:javascript
复制
Rp->rhome = RHome;
Rp->home = getRUser();
Rp->CharacterMode = LinkDLL;
Rp->ReadConsole = myReadConsole;
Rp->WriteConsole = myWriteConsole;
Rp->CallBack = myCallBack;
Rp->ShowMessage = askok;
Rp->YesNoCancel = askyesnocancel;
Rp->Busy = myBusy;

为了提供有效的回调,必须在RInside.cpp中进行等效的分配。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5650063

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档