macOS Mojave上的gcc损坏

and*_*487 3 macos gcc

看来我的gcc坏了。

当我尝试从PyPI安装软件包时,出现以下错误:

    ./uwsgi.h:165:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
In file included from core/protocol.c:1:
./uwsgi.h:165:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
Run Code Online (Sandbox Code Playgroud)

XCode命令行工具已安装:

    ?  xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Run Code Online (Sandbox Code Playgroud)

并从brew安装gcc:

?  brew install gcc
Warning: gcc 8.2.0 is already installed and up-to-date
To reinstall 8.2.0, run `brew reinstall gcc`
Run Code Online (Sandbox Code Playgroud)

当我尝试识别使用哪个gcc时/usr/bin/gcc。我认为这是XCode版本。

但是brew中没有gcc二进制文件:

?  ls /usr/local/bin/gcc-*
/usr/local/bin/gcc-8        /usr/local/bin/gcc-ar-8     /usr/local/bin/gcc-nm-8     /usr/local/bin/gcc-ranlib-8
Run Code Online (Sandbox Code Playgroud)

在这种情况下我该怎么办?如何修复gcc?

and*_*487 5

正确的答案是在此线程中:https : //stackoverflow.com/a/52530212/1377912

默认情况下,新的Xcode不提供标头。您应该手动安装它:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Run Code Online (Sandbox Code Playgroud)