- Get the Kythe source code
- Building Kythe
- Updating and building the website
Get the Kythe source code
Decide where you want to store kythe code, e.g.
~/my/code/dir (note that
after we clone from git, it will append ‘kythe’ as the last directory).
Also set the env var
KYTHE_DIR=~/my/code/dir/kythe in your
while you’re at it.
If you use ssh to authenticate to github:
Kythe relies on the following external dependencies:
- bison-3.0.4 (2.3 is also acceptable)
- clang >= 3.6
- cmake >= 3.4.3
- docker (for release images
- go >= 1.7
- jdk >= 8
- leiningen (used to build
- ninja (optional; improves LLVM build speed)
You will need to ensure these packages are installed on the system where you
intend to build Kythe. There are instructions for using
If you are using macOS, see Instructions for macOS.
Installing Debian Jessie Packages
All other Kythe dependencies are hosted within the repository under
//third_party/.... Run the
./tools/modules/update.sh script to update these
dependencies to the exact revision that we test against.
This step may take a little time the first time it is run and should be quick on subsequent runs.
Installing and keeping LLVM up to date
When building Kythe, we assume that you have an LLVM checkout in
third_party/llvm/llvm. If you don’t have an LLVM checkout in that directory, or
if you fall out of date, the
./tools/modules/update.sh script will update you
to the exact revisions that we test against.
Note that you don’t need to have a checkout of LLVM per Kythe checkout. It’s
enough to have a symlink of the
Troubleshooting bazel/clang/llvm errors
You must either have /usr/bin/clang aliased properly, or the CLANG env var set:
If you ran bazel and get errors like this:
then you need to clean and rebuild your TOOLCHAIN:
Building using Bazel
Please note that you must use a non-jdk7 version of Bazel. Some package managers
may provide the jdk7 version by default. To determine if you are using an
incompatible version of Bazel, look for
jdk7 in the build label that
is printed by
Build a release of Kythe using Bazel and unpack it in /opt/kythe
Many examples on the site assume you have installed kythe in /opt/kythe.
Using the Go tool to build Go sources directly
Kythe’s Go sources can be directly built with the
go tool as well as with
The additional benefits of using Bazel are the built-in support for generating
the Go protobuf code in
kythe/proto/ and the automatic usage of the checked-in
third_party/go libraries (instead of adding to your
GOPATH). However, for
quick access to Kythe’s Go sources (which implement most of Kythe’s platform and
language-agnostic services), using the Go tool is very convenient.
Updating and building the website
- Make change in ./kythe/web/site
- Spell check
- Build a local version to verify fixes
Build and serve: