CVS LLVM Requires CVS llvm-gcc?

I am currently trying to build the CVS version of LLVM, and no matter what I do, ./configure always reports that llvm-gcc cannot be found or is not working. I currently have the LLVM 1.4 llvm-gcc binaries. My path is set correctly:

rn-spra1c07:~/llvm/llvm ejones$ which llvm-gcc
/Users/ejones/llvm/cfrontend/ppc/llvm-gcc/bin/llvm-gcc
rn-spra1c07:~/llvm/llvm ejones$ which llvm-g++
/Users/ejones/llvm/cfrontend/ppc/llvm-gcc/bin/llvm-g++

So LLVM is on my path, and I ran configure with:

./configure --with-llvmgccdir=/Users/ejones/llvm/cfrontend/ppc/llvm-gcc/bin

When configure runs, it prints this line:

checking whether llvm-gcc is sane... no

Is this because I need to use the CVS version of llvm-gcc? Or is it a problem with the configure script? The build on my 3 year old powerbook takes a while (30 minutes? An hour? something like that), so I don't know if the warning can be ignored yet. Any ideas?

Thank you,

Evan Jones

Evan,

You need to tell configure where the install directory for all of
llvm-gcc is located. When you configured llvm-gcc you provided a
--prefix option to the configure script. The value of that option
(location of where to install llvm-gcc) is what you need to provide to
--with-llvmgccdir= when configuring LLVM.

You should follow the instructions in the CFEBuildInstrs.html document:
http://llvm.org/docs/CFEBuildInstrs.html as well as the getting started
guide.

Say you have a directory named cfrontend and it contains these
directories:

llvm-gcc
build
install

If you do this:

  cd cfrontend/build
  ../llvm-gcc/configure --prefix=../install ...
  make ; make install

to build your llvm-gcc then the directory you want to provide to LLVM's
--with-llvmgccdir is the install directory (cfrontend/install).

Please note that it is entirely possible to build LLVM without llvm-gcc
if you're working from the CVS head (it wasn't possible in 1.4). You
will still get the big warning from the configure script, but the build
will work as it will just skip the parts that can't be built (and warn
you about that too).

Reid

You need to tell configure where the install directory for all of
llvm-gcc is located.

Ah ha. That was my problem. I forgot that I ran into this with LLVM 1.4 as well. Basically, I specified:

--with-llvmgccdir=/Users/ejones/llvm/cfrontend/ppc/llvm-gcc/bin

instead of:

--with-llvmgccdir=/Users/ejones/llvm/cfrontend/ppc/llvm-gcc

Which does make sense now. For me, the issue was that the directions (http://llvm.cs.uiuc.edu/docs/GettingStarted.html) were slightly misleading. They say:

  ◦ --with-llvmgccdir=directory

Optionally, specify for directory the full pathname of the C/C++ FrontEnd installation to use with this LLVM configuration. If not specified, the PATH will be searched.

I read this to mean "if you can execute llvm-gcc, the configure script will find it." However, it turns out that I needed to remove "/bin" from the directory I added to the PATH. This seems somewhat silly, since that would *not* allow me to execute llvm-gcc in my shell. I don't understand autoconf at all, but it seems to me that it should do "which llvm-gcc" then remove "/bin/llvm-gcc" from the end of that path.

Anyhow, I have it compiling now. Sorry for taking up your time,

Evan Jones

This is a very common error. If someone wanted to contribute a patch to our configure script to make it immune to this problem (e.g. check "$llvmgccdir", and if that fails, check "$llvmgccdir/.."), that would be very handy... :slight_smile:

-Chris