[LLVMdev] Setting up new project

Lane Schwartz dowobeha at gmail.com
Sun Apr 13 15:30:00 PDT 2008

On Sat, Apr 12, 2008 at 3:52 PM, Criswell, John T <criswell at ad.uiuc.edu> 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:

<   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

$ cd ..
$ ./configure --with-llvmsrc=/opt/src-llvm --with-llvmobj=/opt/src-llvm
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

(Obviously change the above path from /opt/src-llvm to wherever your
llvm directory is)

$ make
llvm[2]: Compiling sample.c for Release build
llvm[2]: Building Release Archive Library libsample.a
llvm[2]: Compiling main.c for Release build
llvm[2]: Linking Release executable Sample (without symbols)
llvm[2]: ======= Finished Linking Release Executable Sample (without symbols)

Might I suggest that the above edit be applied to
llvm/projects/sample/autoconf/AutoRegen.sh, and perhaps mention in the
"Creating an LLVM Project" page that the --with-llvmsrc and
--with-llvmobj flags are required?

Thanks for all the help,

More information about the llvm-dev mailing list