2

Rcpp 无法为我安装。当我在 R 控制台(Mac 10.8 上的 R 2.15.1)中运行以下命令时:

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’

我究竟做错了什么?

4

1 回答 1

7

哪个版本的 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 实例关闭此功能。

于 2012-08-10T21:38:49.477 回答