我尝试升级到LLVM 3.4(从源代码构建),现在Clang ++已经崩溃了。它找不到C ++头文件。缺少C头文件似乎也存在问题。例如,它说fatal error: 'algorithm' file not found
。如果我在标志中添加C ++标题的手动包含,那么就会抱怨没有找到string.h。
Clang ++显然会搜索这些路径:
$ /usr/bin/clang++ -cc1 -v
clang -cc1 version 5.0 based upon LLVM 3.3svn default target x86_64-apple-darwin12.4.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/clang/5.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
但它似乎不包含/ usr / include,因为/ usr / include包含string.h。似乎重新安装是最好的,但是当我尝试从我下载的mpkg文件安装Xcode命令行工具时,它仍然无效。我是否必须先删除现有的LLVM / Clang?唯一改变的是我不能再使用clang ++作为它自己的命令,我认为它与macports有关,因为在绝望中我尝试了也失败的macports版本(同样的原因):
$ which clang++
/usr/bin/clang++
$ clang++ -cc1 -v
-bash: /opt/local/bin/clang++: No such file or directory
我正在使用OSX 10.8.4。如何重新安装或修复此问题?
编辑:试图重新安装LLVM / Clang,我得到了这个:
We detected a missing feature in the standard C++ library that was known to be
missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous
C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older
than 4.7. You will need to update your system and ensure Clang uses the newer
standard library.
答案 0 :(得分:0)
Clang没有破碎!
程序指定了一个isysroot
,它不存在,而且clang不会失败,只会发出警告。对于那些不知道的人,这个clang选项完全改变了所有内容的搜索路径!如果clang似乎无法找到头文件,框架,库或其他任何内容,那么检查isysroot
是一个很好的起点。
我手动编辑了MakeFile,以提供正确的isysroot
。这个程序使用qmake,所以也许Qt是责备,或者也许我安装了Qt的macports。我不知道。但我所知道的是,改变MakeFile解决了它。
一个编译器选项的头痛时间!