How-to compile WebRTC on Windows

Hello everyone !
I worked with WebRTC librairies in past six months on various softphone software (AEC implementation) across 3 operating system (Windows, OSX and Android). I’ll show you how-to compile WebRTC on windows, with some interesting tips.
I’ll do other articles on OSX and Android soon.


 

WebRTC compiling on Windows

Preliminary note : 

  • WebRTC can only work with MSVC 14.0 (VS 2013+) due to C++ standard library support issue in VisualC++.
  • You need knowledge on Windows Variable Environnement and eyes to read !

 

Getting the depot-tools

Please refer to this page to install the depot-tools (used to interact with webrtc build).

Do only Step 1 and Step 2

To achieve a good build, go to “Computer > Properties > Advanced System Settings > Environment Variables”

Add the following variable to the User Variables.

GYP_GENERATORS ninja,msvs-ninja
GYP_DEFINES component=shared_library
GYP_MSVS_VERSION 2013

Note : you can modify GYP_DEFINES from shared_library to static_library if you want to generate static library.
Note : For 2013+ Visual Studio version, you can replace 2013 with other values (2015, …)

 

Getting the sources

Please refer to the following chapter of the official webrtc build guide. If the build randomly fail in the next steps, please redo this chapter from scratch.

Note : Take a break and a coffee, it’ll be very long since there are a lot of source files to get.

 

Updating the sources

Execute the following command under src/ folder:

git pull . origin/master
gclient sync

Note: Doing “gclient sync” will regenerate .ninja/.sln files, if you did this after completing “Prepare Project” step, you’ll need to do it again.

 

Prepare project files

Open an Administrator command prompt, and go to the root of the source (under src folder).

webrtc_windows_scr1

In cmd prompt, type :

gclient runhooks

This should generate .sln all over the source folders.

 

Building the source from Command Prompt

You can now start the build by typing

ninja -C out/Debug
ninja -C out/Release
ninja -C out/Debug_x64
ninja -C out/Release_x64 

Note : If the x64 build fail, you may need to run before in src/ folder:

python webrtc\build\gyp_webrtc -Dtarget_arch=x64

Building the source from Visual Studio 2013

In the root folder (src), you should find “all.sln”, open it to access to all the projects files in the WebRTC folder.
Like any other else compilation, select in the toolbar the desired platform and type.

webrtc_windows_scr2

And build the “All” project in the solution (only).


 

Troubleshooting

1. “UTF8” error when building

This error occur when your system is not in English, please go to “Control Panel > Clock Language and Region > Region And Language > Keyboard And Language” and set display language to English.

2. gclient is not recognized

Check if the depot_tools folder is in your path, if it’s the case, close your Command Prompt and open it.

 


 

Notes (advanced)

Minimum Lib needed for AudioProcessing

The following exhaustive list is the minimum library list needed to use AudioProcessing (in my implementation, it may be differente for you)

agc_manager.lib
audio_coding_module.lib
audio_conference_mixer.lib
audio_decoder_interface.lib
audio_device.lib
audio_encoder_interface.lib
audio_processing.lib
audio_processing_sse2.lib
audioproc_debug_proto.lib
audioproc_protobuf_utils.lib
bitrate_controller.lib
channel_transport.lib
common_audio.lib
common_audio_sse2.lib
frame_generator.lib
isac.lib
jsoncpp.lib
media_file.lib
metrics.lib
metrics_default.lib
openmax_dl.lib
pcm16b.lib
protobuf_lite.lib
rtc_base_approved.lib
system_wrappers.lib
webrtc.lib
webrtc_common.lib
webrtc_utility.lib

 


 

Here we are ! It should be all good ! If you have question or problems, please ask me in the comments.
– Jean-Hugues

Continue Reading