Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix a problem with a broken clang: missing stdlib.h

Tags:

xcode

macos

clang

I have a problem with MacOS Mojave 10.14.5 and with the Xcode compiler. Precisely, I'm trying to install a package in R via Github and the compiler is complaning for a missing stdlib.h. Here is the error:

Can please someone explain me how to fix this problem?

clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c bspline.c -o bspline.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from bspline.c:3:
In file included from ./pomp_internal.h:6:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error: 'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in packages */
          ^~~~~~~~~~
1 error generated.
make: *** [bspline.o] Error 1
ERROR: compilation failed for package ‘pomp’
* removing ‘/Users/Atorneri/Library/R/3.6/library/pomp’
* restoring previous ‘/Users/Atorneri/Library/R/3.6/library/pomp’
Error: Failed to install 'pomp' from GitHub:
  (converted from warning) installation of package ‘/var/folders/w7/v79h1vtd38579k18skjw2w280000gn/T//RtmpDSox3s/file3547ba46d4e/pomp_2.2.0.0.tar.gz’ had non-zero exit status
like image 841
andreasvr Avatar asked Jul 01 '19 08:07

andreasvr


1 Answers

Running in Terminal xcode-select --install solved the problem for me.

like image 168
mike_ Avatar answered Nov 03 '22 11:11

mike_