[R-SIG-Mac] fatal error: 'stdio.h' file not found

Eric K er|cjkort @end|ng |rom gm@||@com
Wed Apr 29 16:05:13 CEST 2020


Running R 3.6 has been working fine. I just upgraded to R 4.0 and I cannot
build packages from source. I have tried the following:

1. Installed R 4.0 binary on my mac (macOS 10.14.6). Installation went
fine, but when I try to build packages from source I get errors like this:

* installing *source* package ‘MASS’ ...
** package ‘MASS’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -mmacosx-version-min=10.13
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I/usr/local/include   -fPIC  -Wall -g -O2  -c MASS.c -o MASS.o
MASS.c:18:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>

Indeed, stdlib.h is not in /usr/local/include.

2. So I installed Command_Line_Tools_for_Xcode_11.3.1.dmg, but that did not
fix the problem

3. So I installed Xcode 11.3.1 itself. That did not fix the problem.

4. For good measure, I re-ran xcode-select --install

5. Googling suggested installing /Library/Developer/CommandLineTools/
Packages/macOS_SDK_headers_for_macOS_10.14.pkg, but that package is not on
my computer.

6. I tried building R 4.0 from source with this config.site:

CC=clang
OBJC=$CC
FC=/usr/local/gfortran/bin/gfortran
CXX=clang++

configure went ok, but then the build failed with:

trying to compile and link a JNI program
detected JNI cpp flags    : -I$(JAVA_HOME)/include
-I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -I"/Users/Eric.Kort/build/R-4.0.0/include" -DNDEBUG
-I/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/include/darwin
 -I/usr/local/include   -fPIC  -g -O2  -c conftest.c -o conftest.o
In file included from conftest.c:1:
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/include/jni.h:39:10:
fatal error: 'stdio.h' file not found
#include <stdio.h>

Can anyone spot what I am doing wrong? Thank you!

-Eric

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list