简体   繁体   English

在r软件包安装过程中找不到stdio.h

[英]stdio.h not found during r package installation

I have been having some difficulties with my R install. 我的R安装遇到了一些困难。 I realised that I was unable to install packages and thought that it was due to having been tinkering with the packages I had installed recently. 我意识到我无法安装软件包,并认为这是因为我一直在修改我最近安装的软件包。 As I am a novice I thought that a clean install might fix it so I uninstalled R and Rstudio (via homebrew). 由于我是新手,我认为干净安装可能会修复它所以我卸载了R和Rstudio(通过自制程序)。

On reinstall I'm faced with the same issue. 在重新安装时,我遇到了同样的问题。 This is part of the console output from 这是控制台输出的一部分

install.packages("tidyverse") install.packages( “tidyverse”)

/usr/local/opt/llvm/bin/clang -fopenmp -I"/usr/local/Cellar/r/3.5.1/lib/R/include" -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c assumptions.c -o assumptions.o
In file included from assumptions.c:21:
/usr/local/Cellar/r/3.5.1/lib/R/include/Rinternals.h:39:11: fatal error: 'stdio.h' file not found
# include <stdio.h>
      ^~~~~~~~~
1 error generated.

Searching this site and others suggested that this is to do with lacking the Xcode command line tools. 搜索此站点和其他人建议这与缺少Xcode命令行工具有关。 I have checked that these are installed. 我已经检查过这些已安装。

Searching for stdio.h in terminal shows numerous versions in the various subfolders (tvos, iOS etc.) 在终端中搜索stdio.h会在各个子文件夹(tvos,iOS等)中显示多个版本

other missing files include: stdlib.h, assert.h and unistd.h 其他缺少的文件包括:stdlib.h,assert.h和unistd.h

I can provide the full output if that would help 如果有帮助,我可以提供完整的输出

Further searches have identified that in Xcode 10 (as is bundled with macOS Mojave), the location of the standard path for stdio.h and other utilities has moved. 进一步的搜索已经确定,在Xcode 10中(与macOS Mojave捆绑在一起),stdio.h和其他实用程序的标准路径的位置已经移动。

"Legacy software" that looks for the macOS headers in the base system under /usr/include will not find the required files. 在“/ usr / include”下查找基本系统中的macOS标头的“旧版软件”将找不到所需的文件。

To patch this, Xcode includes a package to create links for such software to find the files. 为了对此进行修补,Xcode包含一个包,用于为此类软件创建链接以查找文件。

For Xcode 10 the package file is located at: 对于Xcode 10,包文件位于:

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

This information was sourced from the apple Developer forums 此信息来自apple Developer论坛

After installing this package and restarting the computer I have successfully installed the tidyverse. 安装此软件包并重新启动计算机后,我已成功安装了tidyverse。

I did run into another issue where my C compiler was not able to create executables but this was solved in this thread . 我确实遇到了另一个问题,我的C编译器无法创建可执行文件,但这已在此线程中解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM