sazary
sazary

Reputation: 966

How to build Clang?

I want to build a program (YCM for VIM) which needs compiled Clang binaries to be linked with. For a reason, I can't use precompiled version which llvm itself offers for download (I've tested it, it doesn't work), so I want to build Clang and then build YCM, both with gcc.
For YCM to be built, I need compiled Clang files in the same way that they are in the precompiled package that llvm offers, that is there should be these folders:

bin  docs  include  lib  share

with corresponding files in them.
Now, I can build llvm and Clang with these commands:

mkdir llvm && cd llvm
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ..
cd ..
mkdir llvm-build && cd llvm-build
../llvm/configure --prefix=/usr/clang_3_4 --enable-optimized --enable-targets=host --disable-compiler-version-checks
make -j 8  

after these, I get these folders in my llvm-build folder:

bindings  config.log     docs      include  LLVMBuild.cmake  Makefile        Makefile.config     projects         test   unittests
cmake     config.status  examples  lib      llvm.spec        Makefile.common  Makefile.llvmbuild  Release+Asserts  tools  utils

How can I create the files in the aforementioned way?

Upvotes: 1

Views: 1348

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273366

I think you should then run sudo make install.

You can also set the configure prefix to a local dir (e.g. somewhere in $HOME) if you don't want it to get copied into the system dirs and needing root access.

Upvotes: 1

Related Questions