problem building llvm + 4.2 frontend from svn

I checked out LLVM and configured like this:

./configure --prefix=/home/regehr --enable-optimized

then built and installed it. Then, checked out the frontend, configured like this:

../configure --prefix=/home/regehr --enable-languages=c,c++ \
--enable-llvm=/home/regehr/z/llvm

but when I try to build I get

configure: error: You must specify valid path to your LLVM tree with --enable-llvm=DIR

The dir I specified is correct, and it is being passed properly to gcc/configure. The problem seems to be that my llvm stuff is going into a "Release" directory, whereas the stuff in gcc/configure starting around line 7384 is checking a list of dirs including "Release-Asserts", "Debug-Asserts", etc. -- but not including "Release" so I'm falling into the else clause.

Am I doing something silly or is this a bug? Thanks,

John Regehr

Hi John,

I think --enable-llvm (for the front-end compilation) expects the object directory used during the LLVM compilation.
I followed the following sequence and got both LLVM and front end installed on Ubuntu 7.10. Hope this helps.

Let’s say you start out at BASE_DIR

[BASE_DIR]$ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

[BASE_DIR]$ mkdir llvm-objects
[BASE_DIR]$ cd llvm-objects

[BASE_DIR/llvm-objects]$ sudo …/llvm/configure --prefix=/usr/local/ --program-prefix=llvm- --enable-llvm=$BASE_DIR/llvm/ --disable-shared --disable-multilib --disable-bootstrap --enable-languages=c,c++

[BASE_DIR/llvm-objects]$ sudo make ENABLE_OPTIMIZED=0
[BASE_DIR/llvm-objects]$ sudo make install

[BASE_DIR/llvm-objects]$ cd …
[BASE_DIR]$ svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk llvm-gcc-4.2

[BASE_DIR]$ mkdir llvm-gcc-4.2-objects
[BASE_DIR]$ cd llvm-gcc-4.2-objects

[BASE_DIR/llvm-gcc-4.2-objects]$ …/llvm-gcc-4.2/configure --prefix=/usr/local --program-prefix=llvm- --enable-llvm=$BASE_DIR/llvm-objects/ --enable-languages=c,c++ --enable-checking

[BASE_DIR/llvm-gcc-llvm-4.2-objects]$ sudo make
[BASE_DIR/llvm-gcc-llvm-4.2-objects]$ sudo make install

[BASE_DIR/llvm-gcc-llvm-4.2-objects]$ sudo chmod ugo+rx /usr/local/bin/llvm*

[BASE_DIR/llvm-gcc-llvm-4.2-objects]$ ls /usr/local/bin/llvm*
/usr/local/bin/llvm-ar* /usr/local/bin/llvmc2* /usr/local/bin/llvm-dis* /usr/local/bin/llvm-gccbug* /usr/local/bin/llvm-nm*
/usr/local/bin/llvm-as* /usr/local/bin/llvm-config* /usr/local/bin/llvm-extract* /usr/local/bin/llvm-gcov* /usr/local/bin/llvm-prof*
/usr/local/bin/llvm-bcanalyzer* /usr/local/bin/llvm-cpp* /usr/local/bin/llvm-g++* /usr/local/bin/llvm-ld* /usr/local/bin/llvm-ranlib*
/usr/local/bin/llvm-c++* /usr/local/bin/llvm-db* /usr/local/bin/llvm-gcc* /usr/local/bin/llvm-link* /usr/local/bin/llvm-stub*

regards,
Prakash

Hi,

./configure --prefix=/home/regehr --enable-optimized

...

../configure --prefix=/home/regehr --enable-languages=c,c++ \
--enable-llvm=/home/regehr/z/llvm

I think gcc from svn has checking enabled by default (which means
it wants to use LLVM built with checking enabled). Try configuring
llvm-gcc with --enable-checking=release or compile an unoptimized
LLVM.

Ciao,

Duncan.

Thanks Duncan and Prakash. I ended up using Duncan's suggestion since I want an optimized LLVM.

John