2012-11-29 52 views
2

我下載並開始構建LLVM/CLANG。我最初安裝了gcc版本4.1.2 20080704(紅帽4.1.2-48),但LLVM網站聲稱使用更高版本。於是我下載並編譯/構建了GCC gcc版本4.7.2(GCC)。現在,我開始設置下面的配置後建立LLVM:GCC:拾取錯誤版本的標題

# setenv PATH /usr/local/lib:/usr/local/lib64:$PATH 
# setenv LD_LIBRARY_PATH /usr/local/lib/:/usr/local/lib64/ 
# setenv CC /usr/local/bin/gcc 

記下GCC 4.1.2可用的是/ usr/bin中,而4.7.2我發現它在/ usr/local/bin目錄的路徑默認

但LLVM編譯失敗說明:

In file included from /x/home/satprasad/llvm/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc:35: 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/algorithm:64: 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:69: 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:45: 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h:38: 
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h:132: 
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h:100:1: error: weakref declaration must have 
     internal linkage 
__gthrw(pthread_once) 

但它應該選擇的文件/頭爲4.7.2版本4.1.2沒有的 - 你可以請讓我知道如何解決這個問題 - 行給出錯誤的文件/代碼如下:

llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc 

#include <algorithm> 

在此先感謝

+0

我在CentOS上也遇到了這個問題。不完全一樣的症狀,但使用gcc 4.7.2。我放棄並下載了轉速,而且工作正常。 – cdarke

回答

1

運行:

./configure --help

顯示此選項:

--with-gcc-toolchain Directory where gcc is installed.

所以嘗試:

--with-gcc-toolchain /usr/local

而且沒有設置任何環境變量秒。

+0

沒有同樣的問題 – Prakash

+1

那麼我建議在[LLVM郵件列表](http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev)上提問。 –

+0

我沒有得到一個完整的具體選項,但安裝最新的GCC與DESTDIR =/usr或配置--prefix =/usr解決了這個問題。請注意,我只能使用最新版本的GCC。鏈接中提到了其他方式:http://gcc.gnu.org/faq.html#multiple,但是因爲對於較舊的版本,我沒有任何代碼,二進制文件或RPM,我重新安裝了最新版本 – Prakash