[llvm-dev] Building LLVM Pass with in Source Tree

Jonathan Roelofs via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 22 13:54:38 PDT 2015



On 10/22/15 2:19 PM, vivek pandya via llvm-dev wrote:
> Hello ,
>
> I am following http://llvm.org/docs/WritingAnLLVMPass.html this to build
> a simple pass with in the source tree.

There's two meanings of "in source" here. One of them is "your new pass 
lives alongside all the other passes in the source directory", and the 
other is "your build directory is your source directory, i.e. 
`./configure` not `../llvm/configure`)". The latter is specifically 
forbidden by the message you encountered. The former is encouraged, but 
not required (and there are instructions on how to build "out of source" 
passes in there somewhere too).

>
> When I try to run make command on my pass directory. I am getting
> following error:

Make needs to be run from the top level of the _build_ directory, not 
from one of the subdirs of the _source_ directory.

>
> ../../../Makefile.common:60: ../../../Makefile.config: No such file or
> directory
>
> ../../../Makefile.common:68: /Makefile.rules: No such file or directory
>
> make: *** No rule to make target `/Makefile.rules'.  Stop.
>
>
> But I think this common as I have not run ./configure on my source tree.
> When I try to run ./configure on my LLVM source tree I am getting
> following error:
>
> configure: error: In-source builds are not allowed. Please configure
> from a separate build directory!
>
>
> Now I build LLVM with separate source directory and put my pass
> directory inside of my build tree. Then I run make it builds

Your pass directory should go somewhere in the source dir, not the build 
dir.

> successfully. opt is able to load my pass correctly.
> But here my question is " *Is this a correct way to build the pass ?*"
> and if In-source builds are not allowed then
> http://llvm.org/docs/WritingAnLLVMPass.html needs to be updated.

Can you point me to the specific instructions there that confused you?


Jon

>
> Please guide !
>
> --
>
> *Vivek Pandya*
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded


More information about the llvm-dev mailing list