Build WebRTC Libraries for Ubuntu

Tested on Ubuntu 18.04
Time ~ 45 Minutes

Install Dependencies

sudo apt-get update && sudo apt-get -y install git python

Install Toolchain

mkdir -p ~/workspace/ && cd ~/workspace/

Install the Chromium depot tools

First, get the repository of depot_tools:

  git clone

Then, add depot_tools to your PATH:

  export PATH=`pwd`/depot_tools:"$PATH"

Download the WebRTC source code

  1. Create a working directory, enter it, and run fetch webrtc (beware fetch requires python2.x):
  mkdir webrtc-checkout
  cd webrtc-checkout
  fetch --nohooks webrtc
  1. These instructions work on branch-heads/57.
      cd src
      git checkout branch-heads/57
  2. Download the code
      gclient sync

Note: The download will take a while, but it no longer downloads the Chromium repository after branch-head/57. Do not interrupt this step or you may need to start all over again (a new gclient sync may be enough, but you might also need to wipe your webrtc_checkout\src folder and start over).

(Optional) Update your checkout

To update an existing checkout, you can run

git rebase-update
gclient sync

The first command updates the primary Chromium source repository and rebases any of your local branches on top of tip-of-tree (aka the Git branch origin/master). If you don’t want to use this script, you can also just use git pull or other common Git commands to update the repo.

The second command syncs the sub-repositories to the appropriate versions and re-runs the hooks as needed.

Build WebRTC Libraries

These gn flags are critical for compatiabilty with tincan. Turn off iterator_debugging or the mangled symbol names will not match; it causes a debug prefix to added to STL container names. Also, all the pieces of libboringssl do not get assembled. My approach to was to turn off component builds and switch from a shared to a static library and then manually create the libboringssl_asm.a file.

Beware it requires to have the gtk+-2.0 package.

The default configuration is for a 64-bit debug build:

  gn clean out/debug
  gn gen out/debug "--args=enable_iterator_debugging=false is_component_build=false rtc_build_wolfssl=true rtc_build_ssl=false rtc_ssl_root=\"/usr/local/include\""
  ninja -C out/debug/ -t clean
  ninja -C out/debug/ field_trial_default protobuf_lite p2p base jsoncpp

To create a 64-bit release build you must set is_debug = false.

  gn clean out/release
  gn gen out/release "--args=enable_iterator_debugging=false is_component_build=false is_debug=false rtc_build_wolfssl=true rtc_build_ssl=false rtc_ssl_root=\"/usr/local/include\""
  ninja -C out/release/ -t clean
  ninja -C out/release/ field_trial_default protobuf_lite p2p base jsoncpp

Testing WebRTC

cd webrtc/examples/
gn gen out/debug
ninja -C out/debug/ -t clean
ninja -C out/debug/

cd out/debug
./peerconnection_server &

Extract the static libraries

Get TinCan Source Code

Switch to the workspace directory:

cd ~/workspace/

Create ipop-project directory and download the TinCan repository there:

For master branch (Development):

mkdir -p ipop-project/ && git clone ipop-project/Tincan

For other branches, for instance bh1 (Latest Stable Release):

mkdir -p ipop-project/ && git clone -b bh1 --single-branch ipop-project/Tincan


mkdir -p ipop-project/Tincan/external/3rd-Party-Libs/release ipop-project/Tincan/external/3rd-Party-Libs/debug

Copy the WebRTC Libraries to TinCan

These freshly built libraries will replace the existing libraries.

Currently, the libraries we need from out/Debug_x64 and out/Release_x64 are:


ar -rcs Tincan/external/3rd-Party-Libs/release/libjsoncpp.a webrtc-checkout/src/out/release/obj/third_party/jsoncpp/jsoncpp/json_reader.o webrtc-checkout/src/out/release/obj/third_party/jsoncpp/jsoncpp/json_value.o webrtc-checkout/src/out/release/obj/third_party/jsoncpp/jsoncpp/json_writer.o

cp webrtc-checkout/src/out/release/obj/webrtc/p2p/librtc_p2p.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/p2p/libstunprober.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/base/librtc_base_approved.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/base/librtc_task_queue.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/base/librtc_base.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/libwebrtc_common.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/base/third_party/libevent/libevent.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/third_party/protobuf/libprotobuf_lite.a Tincan/external/3rd-Party-Libs/release
cp webrtc-checkout/src/out/release/obj/webrtc/system_wrappers/libfield_trial_default.a ipop-project/Tincan/external/3rd-Party-Libs/release


ar -rcs Tincan/external/3rd-Party-Libs/debug/libjsoncpp.a webrtc-checkout/src/out/debug/obj/third_party/jsoncpp/jsoncpp/json_reader.o webrtc-checkout/src/out/debug/obj/third_party/jsoncpp/jsoncpp/json_value.o webrtc-checkout/src/out/debug/obj/third_party/jsoncpp/jsoncpp/json_writer.o

cp webrtc-checkout/src/out/debug/obj/webrtc/p2p/librtc_p2p.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/p2p/libstunprober.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/base/librtc_base_approved.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/base/librtc_task_queue.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/base/librtc_base.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/libwebrtc_common.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/base/third_party/libevent/libevent.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/third_party/protobuf/libprotobuf_lite.a Tincan/external/3rd-Party-Libs/debug
cp webrtc-checkout/src/out/debug/obj/webrtc/system_wrappers/libfield_trial_default.a ipop-project/Tincan/external/3rd-Party-Libs/debug

*These instructions are derived from following links and through experimentation with WebRTC itself. They may change as depot_tools and WebRTC are updated by their respective developers.