Building LLVM/Clang

Hello everyone,

I am having trouble trying to build LLVM/Clang.

Here’s the steps I followed:

mkdir static_analysis
cd static_analysis

  • svn co [http://llvm.org/svn/llvm-project/llvm/trunk](http://llvm.org/svn/llvm-project/llvm/trunk) llvm
  • cd llvm/tools
  • svn co [http://llvm.org/svn/llvm-project/cfe/trunk](http://llvm.org/svn/llvm-project/cfe/trunk) clang
  • cd ../..
  • cd llvm/tools/clang/tools
  • svn co [http://llvm.org/svn/llvm-project/clang-tools-extra/trunk](http://llvm.org/svn/llvm-project/clang-tools-extra/trunk) extra
  • cd ../../../..
  • cd llvm/projects
  • svn co [http://llvm.org/svn/llvm-project/compiler-rt/trunk](http://llvm.org/svn/llvm-project/compiler-rt/trunk) compiler-rt
  • cd ../..
    Now that I am back in top level directory I issued the “make” cmd and this is what I get:

make: *** No targets specified and no makefile found. Stop.

I also tried issuing “make” cmd from llvm directory:
$ cd static_analysis/LLVM/
$ make

and this is what I get:
Makefile:44: Makefile config: No such file or directory
Makefile:151: /Makefile.rules: No such file or directory
make: *** No rule to make target `/Makefile.rules’. Stop.

You need to run make first; it’ll generate the makefiles.
I’d recommend performing an out of source build. If you don’t know what that is, I’m happy to explain.

You need to run cmake*

Hi,

To expound upon what Joshua said:

  • cd ../..
    Now that I am back in top level directory I issued the “make” cmd and this is what I get:

make: *** No targets specified and no makefile found. Stop.

  • mkdir build
  • cd build
  • cmake … -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON
  • make -j12

James

Hi,

you could use the attached script.
Note that the script also includes clang tools and compiler-rt.

-Alex

llvm_clang_compiler_rt.sh (1.09 KB)