[LLVMdev] question about compile path

John Criswell criswell at cs.uiuc.edu
Thu Feb 3 07:44:50 PST 2005


Qiuyu Zhang wrote:
> Hi,
>  
> 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
--with-llvmobj=/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
/home/qiuyu/project/statBB.

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
already do.

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.

Regards,

John T. Criswell


>  
> The environment is as the following,
> /opt/llvm : // llvm 1. 4 
> /home/qiuyu/   ://my home directory
> /home/qiuyu/project/statBB ://my project directory
>  
> I create a simple pass to test it. The content of Makefile is
>  
> LEVEL = /opt/llvm
> LIBRARYNAME = StatBB
> SHARED_LIBRARY = 1
> include $(LEVEL)/Makefile.common
>  
> Once I do make, I got a error like
> "
> /bin/sh: line 1: cd: /home/qiuyu/project/statBB//opt/llvm/: No such file 
> or directory
>                                              ^^^^^^^
> llvm[0]: Reconfiguring with /opt/llvm/configure
> make: *** [/home/qiuyu/project/statBB/config.status] Error 127
> "
> So I changed the "LEVEL =/opt/llvm" to "LEVEL=../../../../opt/llvm", the 
> error message became to
> "make: *** No rule to make target 
> `/opt/llvm/home/qiuyu/shuffleBB/Makefile', needed by `Makefile'.  Stop.
>                                                                          
> ^^^^^^^
> "
>  
> Finally, I swith to be as root and put my project under 
> /opt/llvm/project/statBB, and LEVEL=../..  and I can make it.
>  
> Is there any way to make it work on my home directory?
>  
> Thanks
>  
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list