在Macbook上编译Python3项目。 'stdio.h'找不到文件错误



我试图使用bazel编译Python3蝗虫测试,但在编译过程中遇到了错误。这是错误的主要部分:

Compiling with an SDK that doesn't seem to exist: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
Please check your Xcode installation
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -g0 -Iext -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c ext/_parser.c -o build/temp.macosx-11-x86_64-3.9/ext/_parser.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk' [-Wmissing-sysroot]
In file included from ext/_parser.c:2:
/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:10: fatal error: 'stdio.h' file not found
#include <stdio.h>

我正在Big Sur 11.6.7版本的Macbook Pro(英特尔(上编译。

我的解决方案感觉非常糟糕,如果有更规范的解决方案,我会接受另一个答案。然而,这似乎让我松了一口气。

错误指出文件夹/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk丢失。我检查了一下文件夹,发现它确实不见了。

✗ ls /Library/Developer/CommandLineTools/SDKs/
MacOSX.sdk      MacOSX10.15.sdk MacOSX11.1.sdk

但是,我确实看到了文件夹MacOSX11.1.sdk的存在。所以我制作了一个符号链接到我的构建中要求的名称的文件夹。。。

cd /Library/Developer/CommandLineTools/SDKs/
sudo ln -s MacOSX11.1.sdk MacOSX11.sdk

最新更新