我試圖升級到LLVM 3.4(從源代碼構建),現在Clang ++已損壞。它無法找到C++頭文件。還有一個缺失C頭文件的問題。例如它說fatal error: 'algorithm' file not found
。如果我在標誌中添加一個手動包含C++頭文件,它會抱怨沒有找到string.h。在OSX Mountain Lion上重新安裝破碎的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嗎?那唯一改變的是,我可以不再使用鐺++作爲它自己的命令,我認爲有事情做與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.
我想我會嘗試再次從源重建LLVM/Clang,雖然這是首先打破它,所以我懷疑這將工作。 –
嘗試使用配置選項'--enable-libcpp = yes' ... –
對於其他人,請勿在/ usr中更改/ usr/local之外的內容,以免影響Apple提供的代碼。在這種情況下,爲什麼不重新安裝Xcode或者命令行工具 - 什麼是實際錯誤 – Mark