Xcode 5.0和OSX 10.8.5和R 3.0.2的Rcpp错误 [英] Rcpp Error with Xcode 5.0 and OSX 10.8.5 and R 3.0.2

查看:65
本文介绍了Xcode 5.0和OSX 10.8.5和R 3.0.2的Rcpp错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在我的Mac上启动Rcpp并运行,但是很挣扎.我已经安装了命令行工具.我已经安装了Rcpp和嵌入式程序包.我尝试在R中运行以下脚本,并得到以下错误.

I'm just trying to get Rcpp up and running on my Mac, but am struggling. I've installed the Command Line Tools. I've installed the Rcpp and inline packages. I try to run the following script in R, and get the following error.

fx <- cxxfunction(signature( x = "numeric" ),

  'NumericVector xx(x);

  return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));',

  plugin = "Rcpp",verbose=TRUE)


Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! /bin/sh: llvm-g++-4.2: command not found
make: *** [file2e731b1c0ff8.o] Error 127

我意识到这与发布的问题非常相似.但是,我希望能参考到在哪里可以找到makevars文件的更多详细信息.

I realize this is very similar to a posted question. But I'd appreciate a reference to more details on where to find the makevars file.

谢谢.

推荐答案

正如我在上一个答案中提到的,您必须更正CRAN提供的R二进制文件中的硬编码值,该C二进制文件是使用 XCode构建的,而XCode仍然具有基于g ++的编译器.您(至少)有三个选择:

As I alluded to in this previous answer, you must correct the values hard-coded in the R binary provided by CRAN which was built with the old XCode which still had the g++-based compiler. You have (at least) three choices:

  1. 直接编辑etc/Makeconf(在R的安装目录下面)以将CCCXX校正为clangclang++.

  1. Edit etc/Makeconf (below R's install directory) directly to correct CC and CXX to clang and clang++.

或者,类似地创建或编辑~/.R/Makevars.

Alternatively, create or edit ~/.R/Makevars similarly.

使用这些负载创建环境变量CCCXX.

Create environment variables CC and CXX with these loadings.

的长处和短处是CCCXX具有R编译时的硬编码值,这些值不再与系统上的值相对应(使用XCode 5).最终,R将赶上,并且此调整将是不必要的.

The long and short of it is that CC and CXX have hard-coded values from R's compile-time which no longer correspond the values on your system (using XCode 5). Eventually, R will catch up and this adjustment will be unnecessary.

R安装和管理手册中有更多关于在给定体系结构上应使用哪些变量和哪些值的说明.

The R Installation and Administration manual has more to say about which variables and which values you should use on a given architecture.

这篇关于Xcode 5.0和OSX 10.8.5和R 3.0.2的Rcpp错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆