我需要为数据分析类安装Rstan。说明在这里发布http://code.google.com/p/stan/wiki/RStanGettingStarted。我正在运行Mac OS 10.5.8和R 2.15.1 GUI 1.52 Leopard build 32位(6188)。我刚刚安装了Xcode版本3.1.4,与豹兼容的Xcode C++编译器(我必须得到一个mac开发人员帐户来执行此操作)。安装Stan for R时和使用Rcpp时编译时出错
每斯坦安装指导,我进入了下面的代码,看看我的编译器工作:
library(inline)
library(Rcpp)
src <- '
std::vector<std::string> s;
s.push_back("hello");
s.push_back("world");
return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')
它返回以下错误:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
Library/Frameworks/R.framework/Versions/2.15/Resources/library/
Rcpp/include/Rcpp/internal/export.h: In function ‘void
Rcpp::internal::export_range__dispatch(SEXPREC*, InputIterator,
Rcpp::traits::r_type_primitive_tag)’:
/Library/Frameworks/R.framework/Versions/2.15/Resources/
library/Rcpp/include/Rcpp/internal/export.h:56: internal
compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for
instructions.
make: *** [file795214e66510.o] Error 1
In addition: Warning message:
running command '/Library/Frameworks/R.framework/Resources/bin/
R CMD SHLIB file795214e66510.cpp 2>
file795214e66510.cpp.err.txt' had status 1
当我尝试安装斯坦:
install.packages('rstan', type = 'source') ]
我收到此警告: 警告消息: 在install.packages(“rstan”,type =“source”)中: 安装包'rstan'具有非零退出状态
我不知道C++如何工作。我所有的编码经验都在R中,并且以前没有要求编译成C++。过去4个小时左右,我一直在努力弄清楚什么是错误的,一遍又一遍地搜索这些错误信息,没有太多的运气。任何帮助将不胜感激,并且还会帮助我班的另外10名有相同或类似问题的其他学生。非常非常感谢你。
你不提你安装的C++编译器,RCPP的版本,和你不提安装推荐的FORTRAN编译器,无论是。我不再运行10.5.8并已升级到10.6.8的XCode包。在这个环境下,使用Rcpp版本:0.9.14,代码无误地运行。通常,这些问题最好提交给Mac-SIG邮件列表,尽管Simon Urbanel偶尔会在SO中看到。 –
我提到我使用的C++编译器是Xcode 3.1.4。 Rcpp版本是今天的最新版本。我对推荐的FORTRAN编译器一无所知,所以想知道更多。 –
OS X上的Rcpp用户遇到了麻烦,因为苹果公司和FSF争夺海湾合作委员会版权的混乱局面---但是Rcpp本身的工作原理与CRAN测试一样。您可能“简单地”需要通过他的站点安装Simon为OS X和R提供的编译器。至于斯坦,开发者并没有完全掌握详细信息,所以我将不得不引导你到与斯坦有关的所有方面。 –