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 上工作,但现在不在了,我不知道为什么。
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/
的“Coatless Professor”解决方案(以及其他多种解决方案),但无济于事。
我不愿意升级到 R 4.0,因为一个关键软件将在较新的 R 环境中停止工作。
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
如有任何建议,我将不胜感激!
我在 Christian Herz 的 post 中找到了这个问题的答案,这里是:
https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/8
我的 Mac 上的头文件混乱,/Library/Developer/CommandLineTools
中正确头文件的符号链接副本错误地放置在 /usr/local/include
中。发生此错误是因为我尝试(未成功)使用 @Roy
此处建议的解决方案在 Catalina 上编译 C 程序: C 程序并导致 Rcpp 出现问题。
为了治愈这种疾病,我遵循了@Christoffer Hammarström 中描述的策略
https://unix.stackexchange.com/questions/39333/how-can-i-remove-all-symbolic-links-with-a-special-target/39341#39341
并删除了 /usr/local/include
中指向 /Library/Developer/CommandLineTools
.
的所有符号链接头文件
确切的命令是:
find /usr/local/include -lname '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/*' -delete
现在 Rcpp 可以正确编译了。
Rcpp 曾经在 R 上工作,但现在不在了,我不知道为什么。
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/
的“Coatless Professor”解决方案(以及其他多种解决方案),但无济于事。
我不愿意升级到 R 4.0,因为一个关键软件将在较新的 R 环境中停止工作。
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
如有任何建议,我将不胜感激!
我在 Christian Herz 的 post 中找到了这个问题的答案,这里是:
https://discourse.slicer.org/t/macos-catalina-10-15-5-compilation-error/12807/8
我的 Mac 上的头文件混乱,/Library/Developer/CommandLineTools
中正确头文件的符号链接副本错误地放置在 /usr/local/include
中。发生此错误是因为我尝试(未成功)使用 @Roy
此处建议的解决方案在 Catalina 上编译 C 程序:
为了治愈这种疾病,我遵循了@Christoffer Hammarström 中描述的策略
https://unix.stackexchange.com/questions/39333/how-can-i-remove-all-symbolic-links-with-a-special-target/39341#39341
并删除了 /usr/local/include
中指向 /Library/Developer/CommandLineTools
.
确切的命令是:
find /usr/local/include -lname '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/*' -delete
现在 Rcpp 可以正确编译了。