用于LLVM的GCC工具链

Joh*_*ing 9 c++ rhel configure llvm

我在RHEL 6.x盒子上运行,当然安装了GCC 4.4.我希望在这台机器上运行LLVM.为了做到这一点,我必须从源代码编译它.为了做到这一点,我需要一个更现代的GCC版本.

所以,按照说明,我建立了GCC 4.8.2:

[snip]
% $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++
% make -j$(nproc)
% make install
Run Code Online (Sandbox Code Playgroud)

我以root身份登录,因此$HOME/toolchains解析为/root/toolchains.

在满足LLVM的先决条件后,我已准备好配置和构建LLVM.

root@dev06 /root/llvm-build # ~/llvm/configure --enable-optimized --prefix=$HOME/toolchains/ --with-gcc-toolchain=/root/toolchains/
checking for clang... no
[snip]
checking target architecture... x86_64
checking whether GCC is new enough... no
configure: error:
The selected GCC C++ compiler is not new enough to build LLVM. Please upgrade
to GCC 4.7. You may pass --disable-compiler-version-checks to configure to
bypass these sanity checks.
root@dev06 /root/llvm-build # 
Run Code Online (Sandbox Code Playgroud)

configure我认为我仍在使用GCC 4.4,即使我通过--with-gcc-toolchain=/root/toolchains/了配置1.让我们确保我正确安装了4.8.2.

root@dev06 /root/llvm-build # $HOME/toolchains/bin/g++ --version
g++ (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)

我如何说服我configure使用GCC /root/toolchains


1:我已经尝试了数路径的变化予指定的--with-gcc-toolchain,inclding /root/toolchain/bin,/root/toolchain/bin/g++

rub*_*nvb 7

正如您所发现的,解决此问题的正确方法是将自定义工具链添加到PATH.这不是系统范围的更改,仅限于您的shell会话.或者,您可以配置:

../llvm/configure CXX=$HOME/toolchains/bin/g++
Run Code Online (Sandbox Code Playgroud)

和类似的选项记录在configure--help输出.

该选项--with-gcc-toolchain只告诉构建的Clang在哪里查找C++标准库和头文件,它与LLVM/Clang构建过程无关.我强烈建议你也建立和安装libc ++和libc ++ abi,​​并将它们与你的新Clang一起使用.