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

时间:2019-02-06 15:56:38

标签: 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/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>

错误消息指向几个缺少的标题,但它们都在我的

  

/usr/local/Cellar/llvm/7.0.1/include/c ++ / v1

对于解决此问题的任何帮助,我们将不胜感激。

sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.3
BuildVersion:   18D4

clang -v
clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

gcc --version
gcc (Homebrew GCC 8.2.0) 8.2.0



setting  value                       
 version  R version 3.5.2 (2018-12-20)
 os       macOS Mojave 10.14.3        
 system   x86_64, darwin17.7.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2019-02-06 

2 个答案:

答案 0 :(得分:1)

更新;

我只记得在其他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 pkg将安装/ include

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

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

答案 1 :(得分:0)

如果无法在RStudio中安装软件包,则似乎可以从R控制台安装软件包。

来源: https://github.com/catboost/catboost/issues/137