I am running on an RHEL 6.x box, which of course has GCC 4.4 installed. I wish to have LLVM running on this machine. In order to do so, I must compile it from source. In order to do that, I need a more modern version of GCC.
So, following the instructions, I have built GCC 4.8.2:
[snip]
% $PWD/../gcc-4.8.2/configure --prefix=$HOME/toolchains --enable-languages=c,c++
% make -j$(nproc)
% make install
I'm logged in as root, so $HOME/toolchains
resolves to /root/toolchains
.
After satisfying prerequisites for LLVM, I'm ready to configure and build 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
thinks I'm using GCC 4.4 still, even though I passed --with-gcc-toolchain=/root/toolchains/
to configure1. Let's make sure that I installed 4.8.2 properly.
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.
How do I convince configure
to use the GCC I have at /root/toolchains
?
1: I have tried a number of variations of the path I specify in --with-gcc-toolchain
, inclding /root/toolchain/bin
, /root/toolchain/bin/g++
, etc.