Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:无法更新包clang找不到头文件_R_Macos_Llvm Clang - Fatal编程技术网

R:无法更新包clang找不到头文件

R:无法更新包clang找不到头文件,r,macos,llvm-clang,R,Macos,Llvm Clang,我有几个R包未能从源代码处更新/遵守。以下是错误消息的片段 clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.2_2/lib/R/include" -DNDEBUG -I"/Volumes/Documents/Users/akihoji/Library/R/3.x/library/Rcpp/include" -I"/Volumes/Documents/Users/akihoji/Library/R/3.x/library/RcppArmadillo

我有几个R包未能从源代码处更新/遵守。以下是错误消息的片段

clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.5.2_2/lib/R/include" -DNDEBUG  -I"/Volumes/Documents/Users/akihoji/Library/R/3.x/library/Rcpp/include" -I"/Volumes/Documents/Users/akihoji/Library/R/3.x/library/RcppArmadillo/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include   -fPIC  -g -O2 -c RcppExports.cpp -o RcppExports.o
    In file included from RcppExports.cpp:4:
    In file included from /Volumes/Documents/Users/akihoji/Library/R/3.x/library/RcppArmadillo/include/RcppArmadillo.h:31:
    In file included from /Volumes/Documents/Users/akihoji/Library/R/3.x/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
    In file included from /Volumes/Documents/Users/akihoji/Library/R/3.x/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Volumes/Documents/Users/akihoji/Library/R/3.x/library/Rcpp/include/Rcpp/r/headers.h:59:
    In file included from /Volumes/Documents/Users/akihoji/Library/R/3.x/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    In file included from /usr/local/Cellar/llvm/7.0.1/include/c++/v1/cmath:305:
    /usr/local/Cellar/llvm/7.0.1/include/c++/v1/math.h:301:15: **fatal error: 'math.h' file not found**
另一个

> ** libs clang -I"/usr/local/Cellar/r/3.5.2_2/lib/R/include" -DNDEBUG  -I"/Volumes/Documents/Users/akihoji/Library/R/3.x/library/Matrix/include"
> -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include   -fPIC  -g -O2  -c irlb.c -o irlb.o irlb.c:19:10: fatal error: 'stdlib.h' file not found
> #include <stdlib.h>
更新

我只记得我在另一台Mac上安装OSX Mojave时遇到了完全相同的问题。事实证明,即使在安装命令工具时,/usr/include也不存在,特别是对于Xcode select install的最新版本

我安装的Xcode是

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 10.1.0.0.1.1539992718
volume: /
location: /
install-time: 1549499389
groups: com.apple.FindSystemFiles.pkg-group
此CLT套件将安装/包含在

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include

因此,您所要做的就是将其中一个include文件夹复制或链接到/usr,但要做到这一点,您必须通过在恢复模式下激发crstutil来禁用系统完整性保护

如果不能在RStudio中安装软件包,那么您似乎可以从R控制台安装软件包

资料来源:

合法的做法是为macOS_10.14.pkg-usr/启动sudo安装程序-pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_。这个命令将创建/usr/include和所有的头文件;我不得不使用-target来查看@akh22的评论,也为我修复了它,其他什么都没有。不知道是什么打破了它。@Alextok,你是对的,它应该是-target而不是-usr。谢谢。我需要运行sudo安装程序-allowUntrusted-pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg-target/
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include