Qiuyu Zhang wrote:
I have a question about install path.
Some one installs llvm1.4 under /opt/llvm as root. However, when I
create a project under my home directory, I cannot do Make correctly. It
should be enviroment issue, but I cannot fix it.
This should be possible.
The easiest way to do this is to copy one of the samples in
llvm/projects (such as llvm/projects/sample) and use its Makefiles and
configure script as a template for your project. Doing it this way
allows you to re-use the LLVM build system, as opposed to building your
own set of Makefiles.
So, in the top directory of your project (/home/qiuyu/project/statBB),
you should have a configure script, a Makefile.common.in, and a
Makefile. You should create subdirectories for your source code and
list those subdirectories in the DIR variable in the Makefile.
To use a project, you will need to know the location of the LLVM source
tree (the directory where you unpacked the LLVM source files when you
downloaded LLVM) and object tree (where LLVM was built; often times this
is the same as the source tree). Neither of these is the install
directory (the directory specified by the --prefix option to configure
and used when you issue "make install" to the LLVM build system).
Next, you will use your project's configure script to tell your project
where LLVM is installed. For this example, I will assume that you built
LLVM 1.4 in the directory /home/qiuyu/llvm:
% cd /home/qiuyu/project/statBB
% ./configure --with-llvmsrc=/home/qiuyu/llvm
This should create a Makefile.common inside of
/home/qiuyu/project/statBB. Inside of that Makefile, the variables
LLVM_SRC_ROOT and LLVM_OBJ_ROOT should point to the source tree and
object tree of LLVM 1.4, respectively. This is most likely why your
project fails to build.
After that, you should be able to type "make" inside of
I recommend that you read the document
http://llvm.cs.uiuc.edu/docs/Projects.html for a more complete
description of the LLVM project build system.
Please note that you do not need to use the LLVM project build system to
use LLVM header files, use LLVM tools, or link your programs with LLVM
libraries. We provide the projects build system as a convenience since
most people will want to do in their Makefiles what the LLVM Makefiles
Please email the llvmdev list if you still can't get it to work or if
you have any other questions.
Hope this solves the problem.
John T. Criswell