To download the TokTok stack, use
git clone --recursive https://github.com/TokTok/toktok-stack
You may pass a compiler config for additional compiler-specific warnings and
optimisations. If you use Clang (default on OSX), pass
you use GCC, pass
--config=gcc. On Windows, you don't need any compiler flag
because we assume it's MSVC.
There are also
--config=debug and more. See
.bazelrc in this repository for more config flags you can pass. If you're
using the Docker build, then
msan are also
We recommend copying
customising it according to the comments in that file.
After installing prerequisites (instructions below), run the following command
bazel build //...
To build the stack, first you need to install some software. This guide
assumes an installation of Debian GNU/Linux version 9 and that you are in the
toktok-stack directory. There is partial support for Mac OS X and FreeBSD,
but not all targets can be built on those systems.
Install the latest version of Bazel, e.g.:
wget https://github.com/bazelbuild/bazel/releases/download/3.1.0/bazel_3.1.0-linux-x86_64.deb sudo dpkg -i bazel_3.1.0-linux-x86_64.deb
brew install bazel
sudo pkg install bazel
choco install bazel
To build Qt-based binaries such as
qtox, you need an installation of Qt
development headers and libraries and tools.
sudo apt install qttools5-dev qttools5-dev-tools libqt5svg5-dev
brew install qt
sudo pkg install qt5
choco install qt
If your Qt installation doesn't live in a standard location, make changes to
the detector script in
tools/workspace/qt.bzl and consider sending us a pull
request. If your version of Qt is different, edit
WORKSPACE and adjust it in
Extra development packages
Some libraries have not yet been imported into
third_party, so must be
installed on the system.
sudo apt install libasound2-dev libxss-dev
sudo apt install libxss-dev
On OSX (for both
brew install ncurses
sudo pkg install ncurses
Note that toxic also needs Python 3. See the section on Python for how to install its development files.
py-toxcore-c and other programs using Python FFI, you need Python
toxic both need Python 3. Any of
3.5, 3.6, or 3.7 works.
sudo apt install python3.5-dev
sudo pkg install python3
Native javacpp libraries
Streambot needs native libraries that need to be downloaded from Maven.
wget https://repo1.maven.org/maven2/org/bytedeco/javacpp-presets/ffmpeg/3.4.1-1.4/ffmpeg-3.4.1-1.4-linux-x86_64.jar -O third_party/javacpp/ffmpeg/jar/ffmpeg-3.4.1-1.4-linux-x86_64.jar wget https://repo1.maven.org/maven2/org/bytedeco/javacpp-presets/opencv/3.4.0-1.4/opencv-3.4.0-1.4-linux-x86_64.jar -O third_party/javacpp/opencv/jar/opencv-3.4.0-1.4-linux-x86_64.jar
If you want to build Android apps such as
toktok-android, you need the
Android SDK. E.g.:
wget https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip unzip -d third_party/android/sdk/ commandlinetools-linux-6200805_latest.zip rm commandlinetools-linux-6200805_latest.zip
On OSX, replace
mac in the above instructions.
You will need to install the latest build tools (
aapt and friends) and
platform 28 (targeted by our Android apps) using the SDK manager. Press "y"
to accept all the licenses as you are asked. Use
sdkmanager --list to see
the latest versions of each package after updating.
third_party/android/sdk/tools/bin/sdkmanager --update third_party/android/sdk/tools/bin/sdkmanager 'build-tools;29.0.2' third_party/android/sdk/tools/bin/sdkmanager 'platforms;android-28'
If you want to run instrumentation tests, also install an emulator image:
If you get
Warning: Could not create settings and an exception, run the
following steps instead of the
third_party/android/sdk/tools/bin/sdkmanager --sdk_root=third_party/android/sdk --update third_party/android/sdk/tools/bin/sdkmanager --sdk_root=third_party/android/sdk 'tools'
From then on, you won't need the
--sdk_root flag anymore. See
this stackoverflow for more details.
If you're using Java 11, see this stackoverflow answer if you're getting exceptions or other errors when running sdkmanager.
Building native code for Android
After installing prerequisites (instructions below), run:
bazel build --config=android //c-toxcore/auto_tests/...
WARNING: This build mode does not work at all, yet. Patches welcome!
Installing Android prerequisites
wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip unzip -d third_party/android/ android-ndk-r16b-linux-x86_64.zip
Note that the version of Clang coming with android-ndk-r16b needs libncurses.so.5, which on Debian is in the libncurses5 package.
On OSX, replace
Xcode version must be specified to use an Apple CROSSTOOL
Try running the following:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer sudo xcodebuild -license bazel clean --expunge