如何解决损坏的叮当声问题:缺少 stdlib.h

and*_*svr 4 macos xcode clang

我的 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
Run Code Online (Sandbox Code Playgroud)

小智 11

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


P i*_*P i 7

我通过创建符号链接为同事解决了这个问题。

这是我的文件系统:

pi@piPro18 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
> ls -la
total 0
drwxr-xr-x  5 root  wheel  160 21 Sep 14:05 .
drwxr-xr-x  6 root  wheel  192 11 Sep 12:47 ..
drwxr-xr-x  4 root  wheel  128 30 Aug 07:47 DriverKit19.0.sdk
drwxr-xr-x  8 root  wheel  256 30 Aug 07:47 MacOSX.sdk
lrwxr-xr-x  1 root  wheel   10 21 Sep 14:02 MacOSX10.14.sdk -> MacOSX.sdk
Run Code Online (Sandbox Code Playgroud)

他缺少那个符号链接。所以我们创建了它:

sudo ln -s MacOSX.sdk MacOSX10.14.sdk

来自https://github.com/mapnik/python-mapnik/issues/167

最近(?),Apple 决定停止使用版本来命名其 SDK,而是将其命名为 MacOSX.sdk 并在版本名称中包含别名以实现兼容性

对我来说,剩下的一个谜是为什么我有符号链接,但我的同事没有。如果有人能解释这一点,请发表评论。


Tha*_* Vu 1

也许未找到/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk。您可以尝试将 xcode 切换到 xcode 应用程序。
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer