RCPP无法在R 3.6.3 macOS Catalina 10.15.7上运行 [英] Rcpp not working on R 3.6.3 macOS Catalina 10.15.7
问题描述
Rcpp曾经在R上工作,但现在不再使用了,我也不知道为什么.
Rcpp used to work on R, but no longer, and I do not know why.
library(Rcpp)
evalCpp("1+1")
返回一长串错误,从
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error 1 occurred building shared library.
继续
/usr/local/clang7/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace
using ::signbit;
~~^
/usr/local/clang7/include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/usr/local/clang7/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/usr/local/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
^
并以
20 errors generated.
make: *** [file35f5fb135d1.o] Error 1
我已经多次安装了命令行工具和Xcode.我也尝试过无衣教授"网址为 https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos-before-r-4.0.0/
的解决方案(以及其他多项解决方案),但无济于事.
I have installed command line tools and Xcode multiple times. I have also tried the "Coatless Professor" solution at https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos-before-r-4.0.0/
, (as well as other multiple solutions), but to no avail.
我不愿意升级到R 4.0,因为关键的软件将无法在较新的R环境中运行.
I am reluctant to upgrade to R 4.0 because a key piece of software will stop working in the newer R environment.
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppArmadillo_0.10.1.0.0 Rcpp_1.0.5
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3
我将非常感谢您提供任何建议!
I would be most grateful for any advice!
推荐答案
我在Christian Herz的一篇帖子中找到了这个问题的答案,地址是: https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/8
I found the answer to this question in a post by Christian Herz, here:
https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/8
头文件混乱,错误地将/Library/Developer/CommandLineTools
中正确头文件的符号链接副本错误地放置在/usr/local/include
中.发生此错误是由于我尝试(未成功)使用 @Roy
在此处建议的解决方案在Catalina上编译C程序的结果: https://stackoverflow.com/questions/58278260/升级到Catalina-10-15后,无法在Mac上编译AC程序
.该解决方案无助于编译我的C程序,并导致Rcpp遇到困难.
Header files on my Mac were disordered, with symlinked duplicates of the correct header files in /Library/Developer/CommandLineTools
incorrectly placed in /usr/local/include
. This error occurred as a result of my trying (unsuccessfully) to compile a C program on Catalina using the solution suggested by @Roy
here: https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15
. The solution did not help to compile my C program and lead to the difficulties with Rcpp.
为治愈这种疾病,我遵循了@ChristofferHammarström中描述的策略 https://unix.stackexchange.com/questions/39333/how-can-i-remove-all-symbolic-links-with-a-special-target/39341#39341
并删除了所有符号链接指向/Library/Developer/CommandLineTools
的/usr/local/include
中的头文件.
To cure this ailment, I followed the strategy of @Christoffer Hammarström described in
https://unix.stackexchange.com/questions/39333/how-can-i-remove-all-symbolic-links-with-a-special-target/39341#39341
and removed all symlinked headerfiles in /usr/local/include
that pointed to /Library/Developer/CommandLineTools
.
确切的命令是:找到/usr/local/include -lname'/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/*'-删除
现在Rcpp可以正确编译了.
The exact command was:
find /usr/local/include -lname '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/*' -delete
and now Rcpp correctly compiles.
这篇关于RCPP无法在R 3.6.3 macOS Catalina 10.15.7上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!