2014-02-28 92 views
0

我試圖升級到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. 
+0

我想我會嘗試再次從源重建LLVM/Clang,雖然這是首先打破它,所以我懷疑這將工作。 –

+0

嘗試使用配置選項'--enable-libcpp = yes' ... –

+0

對於其他人,請勿在/ usr中更改/ usr/local之外的內容,以免影響Apple提供的代碼。在這種情況下,爲什麼不重新安裝Xcode或者命令行工具 - 什麼是實際錯誤 – Mark

回答

0

鏘不破!

該程序指定了一個isysroot哪些不存在和鐺不會失敗,只發出警告。對於那些不知道的,這個鏗鏘的選項完全改變了搜索路徑的一切!如果clang似乎無法找到頭文件,框架,庫或其他任何東西,那麼檢查isysroot是一個很好的開始。

我手動編輯MakeFile以給出正確的isysroot。這個程序使用qmake,所以可能是Qt,或者是我安裝Qt的macports。我不知道。但我所知道的是,改變MakeFile解決了它。

在一個編譯器選項上頭痛的時間!

相關問題