在macOS Catalina上错误安装RcppArmadillo [英] Error install RcppArmadillo on macOS Catalina

查看:75
本文介绍了在macOS Catalina上错误安装RcppArmadillo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了 R编译器工具中的步骤for mac上的Rcpp(对于R 3.6.x),但是当我尝试安装 RcppArmadillo 时发生错误.我没有安装Xcode.app,而是更喜欢使用命令行工具.

I followed the steps in R Compiler Tools for Rcpp on macOS (for R 3.6.x), but an error occurs when I try to install RcppArmadillo. I don't have Xcode.app install, and prefer to use the command line tools instead.

发布的答案

The answers posted here didn't help :(

* installing *source* package ‘RcppArmadillo’ ...
** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether clang++ -std=gnu++11 accepts -g... (cached) yes
checking whether g++ version is sufficient... almost
configure: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++.
checking for macOS... found
checking for macOS Apple compiler... not found
checking for clang compiler... found
checking for OpenMP compatible version of clang... found and suitable
checking LAPACK_LIBS... system LAPACK found
checking for OpenMP... missing
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloConfigGenerated.h
config.status: creating src/Makevars
** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG  -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -I../inst/include  -fPIC  -g -O2  -c RcppArmadillo.cpp -o RcppArmadillo.o
In file included from RcppArmadillo.cpp:22:
In file included from ../inst/include/RcppArmadillo.h:31:
In file included from ../inst/include/RcppArmadilloForward.h:26:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/RcppCommon.h:29:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp/r/headers.h:59:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp/platform/compiler.h:100:
In file included from /usr/local/clang7/include/c++/v1/cmath:305:
/usr/local/clang7/include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
              ^~~~~~~~
1 error generated.
make: *** [RcppArmadillo.o] Error 1
ERROR: compilation failed for package ‘RcppArmadillo’
* removing ‘/usr/local/lib/R/3.6/site-library/RcppArmadillo’
* restoring previous ‘/usr/local/lib/R/3.6/site-library/RcppArmadillo’

The downloaded source packages are in
    ‘/private/var/folders/ny/f06ns0d568bgf6s559z8j_9m0000gn/T/Rtmp0t1pHj/downloaded_packages’
Warning message:
In install.packages("RcppArmadillo") :
  installation of package ‘RcppArmadillo’ had non-zero exit status

推荐答案

此答案中提到的一个旁注保存了我.技巧是将以下行添加到 $(R RHOME)/etc/Makeconf

A side note mentioned in this answer saved me. The trick is to add the following line to $(R RHOME)/etc/Makeconf

CPPFLAGS = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include

这篇关于在macOS Catalina上错误安装RcppArmadillo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆