2

我下载并开始构建 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>

提前致谢

4

1 回答 1

1

跑步:

./configure --help

显示此选项:

--with-gcc-toolchain 安装 gcc 的目录。

所以试试:

--with-gcc-toolchain /usr/local

并且不要设置任何环境变量。

于 2012-11-29T08:03:28.777 回答