【发布时间】:2014-07-03 03:07:11
【问题描述】:
我在 RHEL 6.x 机器上运行,它当然安装了 GCC 4.4。我希望在这台机器上运行 LLVM。为此,我必须从源代码编译它。为了做到这一点,我需要一个更现代的 GCC 版本。
所以,在the instructions 之后,我构建了 GCC 4.8.2:
[snip]
% $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++
% make -j$(nproc)
% make install
我以 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 #
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.
如何说服configure 使用我在/root/toolchains 拥有的GCC?
1:我尝试了多种我在--with-gcc-toolchain 中指定的路径的变体,包括/root/toolchain/bin、/root/toolchain/bin/g++ 等。
【问题讨论】:
-
$HOME/toolchains/bin/g++ --version给你4.8.2不代表系统看到这个安装。简单的g++ --version应该是 4.8.2。我认为您已经尝试将安装路径添加到 PATH 变量中,或者没有?如果是,顺序是否正确? -
@mishr:但是我在
configure的命令行上指定了--with-gcc-toolchain=/root/toolchains/? -
读者注意:做
export PATH=/root/toolchains/bin/:$PATHdid 让我可以干净地运行configure,但我宁愿不要到处这样做,这似乎暗示@ 987654340@ 和我想的不一样。