r - R: 无法更新包 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
解决方案
更新;
我只记得当我在另一台 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 来禁用系统完整性保护。
推荐阅读
- sql - 使用 uniq ID 对日期范围和岛屿进行分组,而无需按分隔符进行分区
- documentation - 我想做文档查看器
- mysql - 如何根据 R Mysql DB 中的时间戳删除表?
- android - 无法使用 Retrofit 2.6.1 成功发送 POST 请求 - JSON 转换器的问题
- node.js - 如何从谷歌云应用引擎服务获取服务器端网络统计信息(如 Webalizer)
- dataframe - 删除火花数据框中的标点符号
- php - 从数据库中获取数据并通过 phpMailer 发送到邮件
- html - 如何区分 HTML 中相同语言的两个字母?
- javascript - 用 JavaScript 制作日历,我怎样才能使循环在 1 的特定日期开始,而不仅仅是隐藏索引
- reactjs - React To Do List,如何将另一个项目添加到 localStorage 键数组