Building llvm-gcc4 on amd64

Hi all,

I spent several hours today trying to compile llvm-gcc4 from svn and llvm from
cvs on amd64 linux. In the case anyone else decides to try the same, this
could ease your pain:

1) check out llvm, llvm-gcc
2) create llvm-obj llvm-gcc-obj
export LLVM_INSTAL=<install_dir>
cd llvm-obj
export LLVM_OBJ=`pwd`
../llvm/configure --prefix=$LLVM_INSTALL --enable-debug-runtime
4) At one point, the build script calls c++, but by default, gcc
installs g++, and (at least 4.0.3 on my machine) doesn't create
c++ alias, so create one if you don't already have it:
ln -s /usr/bin/g++ /usr/bin/c++
5) cd ../llvm-gcc-obj
../llvm-gcc/configure --disable-shared --prefix=$LLVM_INSTALL \
    --enable-languages=c,c++ --enable-llvm=$LLVM_OBJ \
    --program-prefix=llvm- --enable-checking --disable-multilib

llvm-gcc4 README.LLVM doesn't mention that --disable-multilib is
required for amd64. I guess that should be updated.


I added a note. What fails though? This shouldn't be needed.


I am also trying to build llvm-gcc4 and llvm as you are on amd64 linux. I am currently running into the error “Did not get a target machine!” on the first file compiled by xgcc. Did you encounter this error at all?

Also, what distribution did you use? GCC version, and target triple?

-Chandler Carruth

Hi Chandler,

I didn't have to specify target triple at all, just -disable-multilib.
Also, you need to compile things in the proper order. I don't remeber
the order exactly, I think llvm -> llvm_gcc4 -> make check llvm.