我的 MacOS Mojave 10.14.5 和 Xcode 编译器有问题。准确地说,我正在尝试通过 Github 在 R 中安装一个包,而编译器正在为缺少 stdlib.h 而提示。这是错误:

有人可以向我解释如何解决这个问题吗?

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

最佳答案

在终端 xcode-select --install 中运行为我解决了这个问题。

关于xcode - 如何解决 clang 损坏的问题: missing stdlib. h,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56832161/

10-13 03:52