xcode Mac OS Sierra:检查 C 编译器是否工作......否

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40489574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:34:14  来源:igfitidea点击:

Mac OS Sierra: checking whether the C compiler works... no

cxcodemacosgccmacos-sierra

提问by user2212461

I want to compile a C library on my MacOS Sierra system, but I am getting the following error:

我想在我的 MacOS Sierra 系统上编译一个 C 库,但出现以下错误:

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/Users/macuser/Downloads/libr':
configure: error: C compiler cannot create executables

I tried setting the symlink as suggested in OS X 10.9.2: checking whether the C compiler works... no:

我尝试按照OS X 10.9.2 中的建议设置符号链接:检查 C 编译器是否有效...否

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD??efault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.??11.xctoolchain

I tried setting the CC path and install xcode as in https://apple.stackexchange.com/questions/216573/cant-compile-source-code-on-mac:

我尝试在https://apple.stackexchange.com/questions/216573/cant-compile-source-code-on-mac 中设置 CC 路径并安装 xcode :

export CC=clang
xcode-select --install

and accept the license. But nothing worked. Are there any new steps to consider on Sierra to get the command line tools running properly?

并接受许可。但没有任何效果。在 Sierra 上是否有任何新步骤需要考虑以使命令行工具正常运行?

回答by morrislaptop

Start Xcode, select 'Preferences', then 'Locations'. You'll notice a dropdown control at 'Command Line Tools'. Select the newest version, close the dialog window, then call brew again. Restart your computer and run it again.

启动 Xcode,选择“首选项”,然后选择“位置”。您会注意到“命令行工具”中有一个下拉控件。选择最新版本,关闭对话窗口,然后再次调用 brew。重新启动计算机并再次运行它。