clang - getting started with git


Are there instruction for checking out/compiling clang with git
instead of svn? Is it possible to build clang with ninja instead of

The getting started doc is for svn -

Many — perhaps even most — of us do use git, despite the repository
being canonically in svn. provides a standard git mirror, which
you can read about on LLVM's Getting Started page:

If you're planning on committing patches yourself, I would recommend
setting up your repository with git-svn; that's also described in that


here is how I setup my dev environment from scratch:

first I search google for "llvm git", because I can never remember the
git mirror's address. This takes me to

then here's what I do (I'm doing this for real as I'm typing this):

$ mkdir llvm
$ cd llvm
$ git clone
$ mv llvm source
$ cd source/tools
$ git clone
$ cd ../../
$ mkdir debug+asserts
$ cd debug+asserts
$ cmake -G Ninja ../source -DCMAKE_C_COMPILER=clang
$ ninja

You should now be building LLVM/Clang :slight_smile:

A few notes:
You'll need a pretty recent CMake (>=2.8.8 IIRC). If you're on Mac,
you will need to build from source to enable Ninja since CMake doesn't
enable ninja "by default" on mac. You can force it to enable ninja by
passing in a special flag (IIRC it is -DCMAKE_ENABLE_NINJA).
I usually just build ninja from scratch (clone

I hope that helps.
--Sean Silva


Does that means anyone has commit writes in llvm/clang repositories?
It seems dangerous.

Nope. Only people with commit rights may commit that way.


Then what's the point of git-svn? Just use this workflow:

1. Clone the git repository

2. Put it on github or somewhere else accessible

3. Then those with commit rights can pull from the git repository and push it up to svn. Or just make a diff with git if that's what's preferred.

As long as you are working without committing in, you can
live w/o git-svn.

Whenever you would obtain commit access, git-svn could be set up easily.
You may ask again about git-svn, then.

I suppose git-diff could be accepted on the lists.


Would be easier to just pull from the git repository if most developers with commit access uses git-svn.