2012-11-29 44 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