内联和 Xcode 4.2.1 出错

发布于 2024-12-19 11:48:27 字数 1481 浏览 6 评论 0原文

我正在尝试让 inline 包在我的 MacBook 上运行。以下代码块(来自 cxxfunction 示例)失败:

library(inline)
fx <- cxxfunction( signature(x = "integer", y = "numeric" ) , '
    return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
' )
fx( 2L, 5 )

出现此错误:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! make: g++-4.2: No such file or directory
make: *** [file141b5882.o] Error 1

这很奇怪,因为 g++ 可用:

g++ -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

ls /usr/bin | grep gcc
gcc
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2

我在 Mac OS 10.7.2 上运行 Xcode 4.2.1、R 2.14.0。

I'm trying to get the inline package working on my macbook. The following block of code (from the cxxfunction examples) fails:

library(inline)
fx <- cxxfunction( signature(x = "integer", y = "numeric" ) , '
    return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
' )
fx( 2L, 5 )

With this error:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! make: g++-4.2: No such file or directory
make: *** [file141b5882.o] Error 1

This is strange, because g++ is available:

g++ -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

ls /usr/bin | grep gcc
gcc
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2

I've running Xcode 4.2.1, R 2.14.0, on Mac OS 10.7.2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对不⑦ 2024-12-26 11:48:27

经过一些研究后,发现这是一个很容易解决的问题:

sudo ln -sn /usr/bin/g++ /usr/bin/g++-4.2
sudo ln -sn /usr/bin/gcc /usr/bin/gcc-4.2

Inline 和 Rcpp 现在似乎工作正常。

After doing some research, it turns out this is an easy problem to fix:

sudo ln -sn /usr/bin/g++ /usr/bin/g++-4.2
sudo ln -sn /usr/bin/gcc /usr/bin/gcc-4.2

Inline and Rcpp seem to be working correctly now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文