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

Eric K er|cjkort @end|ng |rom gm@||@com
Wed Apr 29 19:23:59 CEST 2020


One more update. I had to add the -isysroot flag to avoid collisions
between incompatible headers when building some packages. Thinking about it
more I remembered that I have also used Homebrew in the past for some
installations of unrelated software (so my installation is not as "Vanilla"
as I previously asserted). I wonder then if the source of my woes here is
collisions between homebrew and Xcode? Regardless, this ~/.R/Makevars is
working for me to allow building source packages with the official R 4.0
binary on macOs 10.14.6 with XCode 11.3.1 :

CFLAGS = -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-Wno-nullability-completeness -Wno-expansion-to-defined -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS =
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-Wno-nullability-completeness -Wno-expansion-to-defined -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS =
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-Wno-nullability-completeness -Wno-expansion-to-defined -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Thanks again!
-Eric


On Wed, Apr 29, 2020 at 1:01 PM Eric K <ericjkort using gmail.com> wrote:

> Thank you Hervé.
>
> So yes, with this ~/.R/Makevars everything works fine again (with a couple
> extra flags to keep things quiet):
>
> CFLAGS = -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
> -Wno-nullability-completeness -Wno-expansion-to-defined
> CXXFLAGS =
> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
> -Wno-nullability-completeness -Wno-expansion-to-defined
> CPPFLAGS =
> -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
> -Wno-nullability-completeness -Wno-expansion-to-defined
>
> I am curious why I need this Makevars with what I believe to be a vanilla
> MacOS / XCode / R installation? But since things are working, my
> curiosity will not keep me up at night.
>
> Thanks again for pointing me in the right direction.
>
> -Eric
>
>
> On Wed, Apr 29, 2020 at 12:42 PM Hervé Pagès <hpages using fredhutch.org> wrote:
>
>> Hi Eric,
>>
>> FWIW, here is what I see on my system (Mojave):
>>
>>    machv2:~ biocbuild$ which clang
>>    /usr/bin/clang
>>
>>    machv2:~ biocbuild$ clang -v
>>    Apple LLVM version 10.0.1 (clang-1001.0.46.4)
>>    Target: x86_64-apple-darwin18.7.0
>>    Thread model: posix
>>    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>>
>>    machv2:~ biocbuild$ ls -l
>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h
>>    -r--r--r--  1 root  wheel  16319 Feb 22  2019
>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h
>>
>> I'm not a Mac expert but I believe these locations for Apple clang and
>> associated standard C header files have not changed for years.
>>
>> Hope this helps,
>> H.
>>
>>
>> On 4/29/20 07:05, Eric K wrote:
>> > 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]]
>> >
>> > _______________________________________________
>> > R-SIG-Mac mailing list
>> > R-SIG-Mac using r-project.org
>> >
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dmac&d=DwIFaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=MF1GsseSwZpmjo7qspeJtAlyY9nDQ_XZnJGweoVjCfE&s=oFtPJDZ3gSkizBSLFUqqZ2SGa402cZZHDFxpHmk5rNM&e=
>> >
>>
>> --
>> Hervé Pagès
>>
>> Program in Computational Biology
>> Division of Public Health Sciences
>> Fred Hutchinson Cancer Research Center
>> 1100 Fairview Ave. N, M1-B514
>> P.O. Box 19024
>> Seattle, WA 98109-1024
>>
>> E-mail: hpages using fredhutch.org
>> Phone:  (206) 667-5791
>> Fax:    (206) 667-1319
>>
>

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list