简体   繁体   中英

stdio.h not found during r package installation

I have been having some difficulties with my R install. 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).

On reinstall I'm faced with the same issue. This is part of the console output from

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. I have checked that these are installed.

Searching for stdio.h in terminal shows numerous versions in the various subfolders (tvos, iOS etc.)

other missing files include: stdlib.h, assert.h and 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.

"Legacy software" that looks for the macOS headers in the base system under /usr/include will not find the required files.

To patch this, Xcode includes a package to create links for such software to find the files.

For Xcode 10 the package file is located at:

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

This information was sourced from the apple Developer forums

After installing this package and restarting the computer I have successfully installed the tidyverse.

I did run into another issue where my C compiler was not able to create executables but this was solved in this thread .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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