GCC:选择错误版本的标题

时间:2012-11-29 07:07:49

标签: gcc llvm clang glibc

我下载并开始构建LLVM / CLANG。我最初安装了gcc版本4.1.2 20080704(Red Hat 4.1.2-48),但LLVM网站声称使用更高的版本。所以我下载并编译/构建了GCC gcc 4.7.2版(GCC)。现在我在设置以下配置后开始构建LLVM:

# 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>

提前致谢

1 个答案:

答案 0 :(得分:1)

运行:

./configure --help

显示此选项:

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

所以试试:

--with-gcc-toolchain /usr/local

不要设置任何环境变量。