Here's how I downloaded and built the source code for
and all its dependencies, as a first step towards getting involved in
its continued development.
$ git clone https://github.com/CoatiSoftware/Sourcetrail.git
I started by reading the
“How to build” section in README.md,
which lists the required dependencies. As for tools, the Debian packages
for cmake, git, and ccache will suffice (and I already had them
Sourcetrail requires Boost 1.67, so I could have used the Debian
package for libboost-all-dev 220.127.116.11, but I downloaded and built the
$ wget https://dl.bintray.com/boostorg/release/1.74.0/source/boost_1_74_0.tar.bz2
$ sha256sum boost_1_74_0.tar.bz2
$ tar xjf boost_1_74_0.tar.bz2 && cd boost_1_74
$ ./bootstrap.sh \
$ ./b2 --link=static --variant=release \
--threading=multi --runtime-link=static \
The Boost C++ Libraries were successfully built!
(I copied these build commands from the Sourcetrail README, but the
also describes the process in detail.)
Sourcetrail requires Qt 5.12.3, but the qtbase5-dev package in Debian is
only for 5.11.3. You can download
(which require you to create a “Qt Account” to get access to “exclusive
services, support and information”), but I followed instructions to
build the Qt5 source
$ git clone https://code.qt.io/qt/qt5.git
Cloning into 'qt5'... […]
$ cd qt5 && git checkout 5.12
Branch '5.12' set up to track remote branch '5.12' from 'origin'.
Switched to a new branch '5.12'
$ perl init-repository --module-subset=default,-qtwebengine
After cloning the repository and submodules, I had a 3GB qt5 directory.
Then I created a separate build directory and ran configure and make to
install the libraries into /usr/local/lib/Qt-5.12.10.
$ sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev \
libglu1-mesa-dev libxrender-dev libxi-dev \
$ cd qt5-build
$ ../qt5/configure -ccache -release -opensource \
-nomake examples -nomake tests
$ make -j3
$ sudo make install
This gave me enough time to bring in some firewood, make the fire, heat
water, have a nice hot bath, find a matching pair of socks with no holes
in them from the Set of All Possible Socks (which lives in my bedroom),
grind some coffee beans, brew coffee, and write this article.
Although I had LLVM installed, as described below, and I set my PATH to
include llvm-config and also set LLVM_INSTALL_DIR to /usr/lib/llvm-10 as
instructed, configure could not find whatever it needed to build QDoc. I
ignored this problem for the moment.
Sourcetrail requires LLVM 10 in order to index C/C++ source code. The
instructions link to this page about
how to build LLVM from source,
but I installed the
llvm-10 packages from apt.llvm.org
to save time.
# cat > /etc/apt/sources.list.d/llvm.list
deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main
deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main
# curl https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
# apt update && apt install -y llvm-10 llvm-10-dev \
llvm-10-tools clang-10 libclang1-10 libclang-10-dev
LLVM 10 is now the “old stable” version. (After I have a working build,
I'll try rebuilding using LLVM 11, the current stable version.)
Finally, with all the dependencies installed, I compiled Sourcetrail
$ cd Sourcetrail
$ mkdir -p build/Release
$ cd build/Release
$ cmake -DCMAKE_BUILD_TYPE=Release \
$ make -j3 Sourcetrail
Sourcetrail also supports Java, and I happened to have OpenJDK 11 and a
recent-ish version of Maven installed, so I enabled the Java build in a
fit of sheer optimism. To my surprise, it just worked.
I started build/Release/app/Sourcetrail and created a new project for
the Sourcetrail source code itself to test that everything worked. I did
have to spend some time adding the correct include paths to Qt and LLVM
before indexing completed successfully. This was my reward: