Setting up new project

Hi,

I am attempting to set up a new frontend project based on the sample
project (I'm following the instructions at
http://llvm.org/docs/Projects.html). In doing so, I hit a problem with
AutoRegen.sh which I worked around, and hit a problem with configure
that I don't know how to work around.

Below is what happens when I attempt to autoconf and configure the
sample project that ships with LLVM. This is on Mac OS X 10.5 with
autoconf 2.6.0. For reference, /opt/src-llvm is where my llvm sources
are, and where I built those sources. My project is in
/opt/src-llvm/projects/sample.

$ cd /opt/src-llvm/projects/sample

$ cd autoconf/
$ ./AutoRegen.sh
Your autoconf was not detected as being 2.5x

I have autoconf 2.6. To keep going I edited AutoRegen.sh and made the
following change:

8c8
< autoconf --version | egrep '2\.5[0-9]' > /dev/null

I should mention that I get the same result if I run configure without
any flags.

Lane

It looks like, in the generated configure script, the LLVM_SRC_ROOT
and LLVM_OBJ_ROOT variables are never updated to reflect the values
passed as command line flags. Only the LLVM_SRC and LLVM_OBJ variables
are updated. But, when the script looks for other scripts (like
install.sh), it looks in the LLVM_SRC_ROOT and LLVM_OBJ_ROOT
directories, not in the LLVM_SRC and LLVM_OBJ directories.

Thanks,
Lane

Below is what happens when I attempt to autoconf and configure the
sample project that ships with LLVM. This is on Mac OS X 10.5 with
autoconf 2.6.0. For reference, /opt/src-llvm is where my llvm sources
are, and where I built those sources. My project is in
/opt/src-llvm/projects/sample.

$ cd /opt/src-llvm/projects/sample

$ cd autoconf/
$ ./AutoRegen.sh
Your autoconf was not detected as being 2.5x

I have autoconf 2.6. To keep going I edited AutoRegen.sh and made the
following change:

This probably isn't going to work. If you want to upgrade the tools, you need to read this:
http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/README.TXT?revision=29529&view=markup
(autoconf/README.TXT)

I would just install 2.5 on your system and make your life easier. Unless you want to take the steps to upgrade the tools (in that case, please submit a patch!).

-Tanya

OK then. I didn't realize that having a newer version would be a problem.

I compiled and installed autoconf 2.59. I still get the same problem:

$ autoconf --version
autoconf (GNU Autoconf) 2.59

$ cd /opt/src-llvm/projects/sample/autoconf
$ ./AutoRegen.sh
$ cd ..

$ ./configure --with-llvmsrc=/opt/src-llvm --with-llvmobj=/opt/src-llvm
configure: error: cannot find install-sh or install.sh in
../../../autoconf ./../../../autoconf

Any other tips? I should mention that I'm working with llvm-2.2, not
the current svn.

Thanks,
Lane

Lane Schwartz wrote:

[snip]
OK then. I didn't realize that having a newer version would be a problem.

I compiled and installed autoconf 2.59. I still get the same problem:

$ autoconf --version
autoconf (GNU Autoconf) 2.59

$ cd /opt/src-llvm/projects/sample/autoconf
$ ./AutoRegen.sh
$ cd ..

$ ./configure --with-llvmsrc=/opt/src-llvm --with-llvmobj=/opt/src-llvm
configure: error: cannot find install-sh or install.sh in
../../../autoconf ./../../../autoconf

Any other tips? I should mention that I'm working with llvm-2.2, not
the current svn.
  

I believe this AutoRegen.sh may be broken. I believe this one (which is part of the poolalloc project) may work for you.

I've attached the script below for your convenience. Please give it a try and let us know if it works.

-- John T.

AutoRegen.sh (1.58 KB)

John Criswell wrote:

[snip]

I forgot to mention; make sure your project is in the llvm/projects directory (e.g. llvm/projects/my_project). I don't think the script will work if you put your project in an arbitrary location.

-- John T.

John,

Thanks for the advice. The script you sent gives me the same problem.
I am now able to work around the issue by making the following change
to the AutoRegen.sh script that comes with the sample project:

16,17c16,17
< llvm_src_root=../../..
< llvm_obj_root=../../..

Hmm... I may have spoken too soon... After making the above change to
AutoRegen.sh,

$ ./AutoRegen.sh
Regenerating aclocal.m4 with aclocal
Regenerating configure with autoconf 2.5x

$ cd ..
$ ./configure
configure: creating ./config.status
config.status: creating Makefile.common
config.status: executing setup commands
config.status: executing Makefile commands
config.status: executing lib/Makefile commands
config.status: executing lib/sample/Makefile commands
config.status: executing tools/Makefile commands
config.status: executing tools/sample/Makefile commands

$ make
../Makefile.common:22: ../../Makefile.common: No such file or directory
make[1]: *** No rule to make target `../../Makefile.common'. Stop.
make: *** [all] Error 1

So I guess my AutoRegen.sh fix isn't so great after all...

Lane

Try using the --with-llvmsrc and --with-llvmobj options to explicitly set the locations of your LLVM source tree and object tree, respectively. I faintly recall seeing this error and seem to recall using these options to work around it.

-- John T.

For a local project, I applied the attached patch to ./configure to make it
work, IIRC. It moves the src/obj dir evaluation earlier. I don't know whether
this is a good solution though.

Torvald

patch (1.5 KB)

OK. Here are the complete steps required to successfully build the
sample project:

$ cd llvm/projects
$ cp -r sample/ myproject
$ cd myproject

$ cd autoconf

Make the following edit to AutoRegen.sh:

16,17c16,17
< llvm_src_root=../../..
< llvm_obj_root=../../..

Lane Schwartz wrote:

  

Try using the --with-llvmsrc and --with-llvmobj options to explicitly set the locations of your LLVM source tree and object tree, respectively. I faintly recall seeing this error and seem to recall using these options to work around it.
    
OK. Here are the complete steps required to successfully build the
sample project:

$ cd llvm/projects
$ cp -r sample/ myproject
$ cd myproject

$ cd autoconf

Make the following edit to AutoRegen.sh:

16,17c16,17
< llvm_src_root=../../..
< llvm_obj_root=../../..
---
  

  llvm_src_root=../..
  llvm_obj_root=../..
    
$ ./AutoRegen.sh
Regenerating aclocal.m4 with aclocal
Regenerating configure with autoconf 2.5x
  
Hmm, if you don't regenerate configure, it works without giving it
--with-llvmsrc.
The problems seems to be that when running AutoRegen.sh, the current
directory is projects/sample/autoconf, but when you run the created
configure, the directory is
projects/sample. Was AutoRegen.sh once in project/sample, and later got
moved to autoconf/ ?

Best regards,
--Edwin