本文介绍了编译Windows下的RInside示例的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经安装了并从CRAN下载了一个。



我的R安装位于 c:\R\R-2.12.2 空格。



我已在 R 中安装了 Rcpp RInside / p>

我执行以下makefile Makefile.win 包含在下载的 RInside binary

  ##  -  *  -  mode:makefile; tab-width:8; -  *  -  
##
##简单Makefile
##
## TODO:
##正确配置非Debian文件位置,[Done]
##允许为非默认R等设置RHOME

##注释掉,如果你需要一个不同版本的R,
##,并设置R_HOME相应地作为环境变量
R_HOME:='cygdrive / c / R / R-2.12.2'

sources:= $(wildcard * .cpp)
程序:= $来源:.cpp =)

##包括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)

##包括Rcpp接口类的头和库
RCPPINCL:= $(shell echo'Rcpp ::: CxxFlags )'| $(R_HOME)/ bin / R --vanilla - slave)
RCPPLIBS:= $(shell echo'Rcpp ::: LdFlags()'| $(R_HOME)/ bin / R --vanilla --slave)

##包括RInside嵌入类的标题和库
RINSIDEINCL:= $(shell echo'RInside ::: CxxFlags ()'| $(R_HOME)/ bin / R --vanilla --slave)
RINSIDELIBS:= $(shell echo'RInside ::: LdFlags()'| $(R_HOME)/ bin / vanilla --slave)

##默认make规则中使用的编译器设置
CXX:= $(shell $(R_HOME)/ bin / R CMD配置CXX)
CPPFLAGS := -Wall $(shell $(R_HOME)/ bin / R CMD config CPPFLAGS)
CXXFLAGS:= $(RCPPFLAGS)$(RCPPINCL)$(RINSIDEINCL)$(R_HOME)/ bin / R CMD config CXXFLAGS)
LDFLAGS = -s
LDLIBS:= $(RLDFLAGS)$(RBLAS)$(RLAPACK)$(RINSIDELIBS)$(RCPPLIBS)
CC: R_HOME)/ bin / R CMD config CXX)

all:$(程序)

clean:
rm -vf $(程序)



 > make -f Makefile.win 

尝试构建包含标准示例



但是,我得到以下错误:

  C:\RInside_0.2.3\ RInside \examples\standard> make -f Makefile.win 
make:cygdrive / c / R / R-2.12.2 / bin / R:找不到命令
make:cygdrive / c / R /R-2.12.2/bin/R:找不到命令
make:cygdrive / c / R / R-2.12.2 / bin / R:找不到命令
make:cygdrive / c / R /R-2.12.2/bin/R:找不到命令
cygdrive / c / R / R-2.12.2 / bin / R:not found
cygdrive / c / R / R-2.12。 2 / bin / R:未找到
cygdrive / c / R / 2.12.2 / bin / R:未找到
cygdrive / c / R /未找到
make:cygdrive / c / R / R-2.12.2 / bin / R:未找到命令
make:cygdrive / c / R / R-2.12.2 / bin / R:命令未找到
make:cygdrive / c / R / R-2.12.2 / bin / R:未找到命令
make:cygdrive / c / R / R-2.12.2 / bin / R:命令未找到
Wall -s rinside_callbacks0.cpp -o rinside_callbacks0
make:Wall:找不到命令
make:[rinside_callbacks0]错误127(被忽略)
Wall -s rinside_module_sample0.cpp -o rinside_module_sample0
make:Wall:找不到命令
make:[rinside_module_sample0]错误127(忽略)
Wall -s rinside_sample0.cpp -o rinside_sample0
make:Wall:Command找不到
make:[rinside_sample0]错误127(被忽略)
Wall -s rinside_sample1.cpp -o rinside_sample1
make:Wall:找不到命令
make:[rinside_sample1] 127(被忽略)
Wall -s rinside_sample2.cpp -o rinside_sample2
make:Wall:找不到命令
make:[rinside_sample2]错误127(被忽略)
Wall -s rinside_sample3 .cpp -o rinside_sample3
make:Wall:找不到命令
make:[rinside_sample3]错误127(忽略)
Wall -s rinside_sample4.cpp -o rinside_sample4
make:Wall :命令未找到
make:[rinside_sample4]错误127(被忽略)
Wall -s rinside_sample5.cpp -o rinside_sample5
make:Wall:找不到命令
make:[rinside_sample5 ]错误127(忽略)
Wall -s rinside_sample6.cpp -o rinside_sample6
make:Wall:找不到命令
make:[rinside_sample6]错误127 s rinside_sample7.cpp -o rinside_sample7
make:Wall:找不到命令
make:[rinside_sample7]错误127(忽略)
Wall -s rinside_sample8.cpp -o rinside_sample8
make :Wall:未找到命令
make:[rinside_sample8]错误127(忽略)
Wall -s rinside_sample9.cpp -o rinside_sample9
make:Wall:找不到命令
make: [rinside_test0]错误127(被忽略)
Wall -s rinside_test0.cpp -o rinside_test0
make:Wall:找不到命令
make:[rinside_test0] Wall -s rinside_test1.cpp -o rinside_test1
make:Wall:未找到命令
make:[rinside_test1]错误127(忽略)

我尝试了 R_HOME 的不同路径,但我怀疑我找到正确的路径的能力。我是新的makefile,所以错误输出没有太多帮助。



希望有人有一些有价值的洞察力分享!



提前感谢,



Christian

解决方案

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

  export R_LIBS_SITE = c: / R / site-library 


I am trying to setup RInside at work where we are forced to use a Windows environment.

I have installed RTools and downloaded an RInside binary from CRAN.

My R installation resides in c:\R\R-2.12.2 so no problems with folders with spaces.

I have installed the Rcpp and RInside packages in R.

I execute the following makefile Makefile.win included in the downloaded RInside binary

## -*- 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)

with the command

make -f Makefile.win

to try an build the standard examples included

However, I get the following error:

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)

I have tried with different paths for R_HOME but I question my ability to having found the right one. I am new to makefiles, so the error output is not of much help.

Hope somebody has some valuable insight to share!

Thanks in advance,

Christian

解决方案

I have a similar setup at work, so I gave this a shot. I'm able to build the examples after I specify R_LIBS_SITE. Note that it must be a Windows path, not a Cygwin path!

export R_LIBS_SITE=c:/R/site-library

这篇关于编译Windows下的RInside示例的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 10:26