Rcpp 无法为我安装。当我在 R 控制台(Mac 2.15.1 上的 R 10.8)中运行以下内容时:
install.packages("Rcpp")
我收到以下错误:
/usr/bin/clang++ -I/usr/local/Cellar/r/2.15.1/R.framework/Resources/include
-DNDEBUG -I../inst/include/ -I/usr/local/Cellar/readline/6.2.4/include
-isystem /usr/local/include -I/opt/X11/include -fPIC -Os -w -pipe -
march=native -Qunused-arguments -mmacosx-version-min=10.8
-c exceptions.cpp -o exceptions.o
exceptions.cpp:82:14: fatal error: 'bits/exception_defines.h' file not found
#include <bits/exception_defines.h>
^
1 error generated.
make: *** [exceptions.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
我做错了什么?
哪个版本的 Rcpp? 这在SVN中是固定的:
2012-07-06 Dirk Eddelbuettel <edd@debian.org> * inst/include/Rcpp/config.h: In order to not attempt to include exception_defines.h if on OS X (as the clang runtime may not have predictable access to g+++ headers providing these), do not define RCPP_HAS_DEMANGLING which is used in src/exceptions.cpp
并在RCPP-DEVEL列表中进行了讨论。
我试图适应OS X和clang>= 3.0,但是clang和g++的交互有点棘手。 尝试从SVN获取文件或仅编辑其中的部分以产生
#ifdef __GNUC__
// from http://sourceforge.net/apps/mediawiki/predef/index.php?
// title=Operating_Systems#MacOS
#ifndef __APPLE__
#ifndef __MACH__
#define RCPP_HAS_DEMANGLING
#endif
#endif
#endif
这将为所有 OS X 实例关闭此功能。