Homebrew安装的Clang无法在Mac OS X上找到标题

时间:2016-08-15 01:04:34

标签: c macos gcc clang llvm-clang

因此,由于没有明显的原因(我没有安装新版本的clang,或者更改了任何编译器配置),clang突然无法在我的Mac上找到assert.h

在我的开发虚拟机中,运行Ubuntu,gccclang都可以正常编译项目;在主机Mac OS X上,gcc仍可正常编译,但clang会吐出以下内容:

> make
clang -g -O0 -Wall -Wextra -pedantic -Wshadow -Wstrict-overflow -Wno-missing-field-initializers -std=c99 -m64 -Wno-unused-variable -Wno-unused-parameter -o csim csim.c cachelab.c -lm
csim.c:1:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^
1 error generated.
cachelab.c:5:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^
1 error generated.
make: *** [csim] Error 1

以下是一些进一步的相关信息:

> xcode-select --print-path
/Applications/Xcode-beta.app/Contents/Developer
> gcc -g -O0 -Wall -Wextra -pedantic -Wshadow -Wstrict-overflow -Wno-missing-field-initializers -std=c99 -m64 -Wno-unused-variable -Wno-unused-parameter -o csim csim.c cachelab.c -lm
> clang -std=c99 -o csim csim.c -v
clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-apple-darwin16.0.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
 "/usr/local/Cellar/llvm/3.8.1/bin/clang-3.8" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name csim.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 273 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /usr/local/Cellar/llvm/3.8.1/bin/../lib/clang/3.8.1 -std=c99 -fdebug-compilation-dir /Users/ec/Dropbox/Documents/Homework/CS351/mps/04 -ferror-limit 19 -fmessage-length 211 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/xt/wm01x2h50nv993t_csb1t5qm0000gn/T/csim-9590db.o -x c csim.c
clang -cc1 version 3.8.1 based upon LLVM 3.8.1 default target x86_64-apple-darwin16.0.0
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/local/Cellar/llvm/3.8.1/bin/../lib/clang/3.8.1/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
csim.c:1:10: fatal error: 'assert.h' file not found
#include <assert.h>
         ^
1 error generated.

0 个答案:

没有答案