fatal error: 'stdio.h' file not found
Normally, you shouldn't need to set -isysroot or SDKROOT when using
Apple Clang -- it will automatically find and use system headers for
you.
Per Herv?'s original point, I wonder if you have a different compiler
on the PATH? What is the output of:
which clang
My suspicion is that you might have an alternate compiler on the PATH
that is being used instead of the default Apple Clang.
You might also check e.g.
xcode-select -p
xcrun --show-sdk-path
just to make sure those are pointing in the right place -- e.g. I have:
kevinushey at Kevins-MBP:~
$ xcode-select -p
/Library/Developer/CommandLineTools
kevinushey at Kevins-MBP:~
$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
You could also set CC=/usr/bin/clang just to force the use of the
system compiler (and avoid looking up whatever is first on the PATH).
Best,
Kevin
On Wed, Apr 29, 2020 at 10:24 AM Eric K <ericjkort at gmail.com> wrote:
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 at 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 at 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 at 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 at fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac