/ home / Documentation / v3 / libmediasoupclient / Installation

libmediasoupclient v3 Installation


Build libwebrtc

libmediasoupclient makes use of Google's libwebrtc C++ library. Follow the official instructions by checking out branch branch-heads/4606 (m94) and build it.

  • Future versions of libmediasoupclient will include a more recent version of libwebrtc. For now, supported version is m94 branch.
  • The Build Examples section below provides some hints about how to build libwebrtc and libmediasoup client in different platforms.
  • When building libwebrtc, you may want to include rtc_include_tests=true into arguments given to gn gen. This is needed for some unit tests in libmediasoupclient.
  • The link to the libwebrtc “official instructions” above may be broken in the future. If so, please don't ask the mediasoup authors about it. Google is your friend.
  • If you encounter any issue building libwebrtc in a specific platform, check the libwebrtc documentation (wherever it is). We, the mediasoup authors, do not provide support about libwebrtc and our expertise is not for free.

Build libmediasoupclient

Get the libmediasoupclient sources via git and check-out the latest version (git tag):

$ git clone
$ cd libmediasoupclient/
$ git checkout 3.X.Y.

Within the libmediasoupclient/ folder:

$ cmake . -Bbuild \

$ make -C build/

Optionally install the library in the system:

$ make install -C build/

Depending on the host, it will generate the following static library and header files:

-- Installing: /usr/local/lib/libmediasoupclient.a
-- Up-to-date: /usr/local/include/mediasoupclient/mediasoupclient.hpp

Building Flags

Argument Type Description Required Default
LIBWEBRTC_INCLUDE_PATH Path Path to libwebrtc sources (the src folder). Yes  
LIBWEBRTC_BINARY_PATH Path Path to the libwebrtc static library. Yes  
MEDIASOUPCLIENT_LOG_DEV Bool Enable MSC_LOG_DEV C++ macro. See Logger. No false
MEDIASOUPCLIENT_LOG_TRACE Bool Enable MSC_LOG_TRACE C++ macro. See Logger. No false
MEDIASOUPCLIENT_BUILD_TESTS Bool Run the unit tests. No No
CMAKE_CXX_FLAGS String C++ flags (see “Linkage Considerations” section below). No  

Linkage Considerations (1)

The application is responsible for defining the symbol visibility of the resulting binary. Symbol visibility mismatch among different libraries will generate plenty of linker warnings such us the one below:

ld: warning: direct access in function 'webrtc::I010Buffer::Rotate(webrtc::I010BufferInterface const&, webrtc::VideoRotation)'
from file '/home/foo/src/webrtc-checkout/src/out/m74/obj/libwebrtc.a(i010_buffer.o)'
to global weak symbol 'void rtc::webrtc_checks_impl::LogStreamer<>::Call<>(char const*, int, char const*)::t'
from file '../libmediasoupclient.a(PeerConnection.cpp.o)' means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.

In order to avoid such warnings make sure the corresponding visibility compilation flags are provided. For example, if libwebrtc was built with hidden symbol visibility, libmediasoupclient needs to be provided with the correspoinding compilation flag:

cmake . -Bbuild \

Linkage Considerations (2)

Linkage errors may happen if libwebrtc and libmediasoupclient are not compiled with the same C++ standard library.

Build libwebrtc with the 'use_custom_libcxx=false' gn gen argument to force it use of the system libstdc++.

Build Examples

$ cd /home/foo/src
$ mkdir webrtc-checkout
$ cd webrtc-checkout
$ fetch --nohooks webrtc
$ gclient sync
$ cd src
$ git checkout -b m94 refs/remotes/branch-heads/4606
$ gclient sync
$ gn gen out/m94 --args='is_debug=false is_component_build=false is_clang=true rtc_include_tests=false rtc_use_h264=true use_rtti=true mac_deployment_target="10.11" use_custom_libcxx=false'
$ gn gen out/m94 --args='is_debug=false is_component_build=false is_clang=false rtc_include_tests=false rtc_use_h264=true use_rtti=true use_custom_libcxx=false treat_warnings_as_errors=false use_ozone=true'
$ ninja -C out/m94
$ cd /home/foo/src/libmediasoupclient

$ cmake . -Bbuild \
  -DLIBWEBRTC_INCLUDE_PATH:PATH=/home/foo/src/webrtc-checkout/src \

$ make -C build/


Once installed include the libmediasoupclient library into your C++ application:

#include "libmediasoupclient/mediasoupclient.hpp"

And add the libmediasoupclient static library to your C++ project.

The libmediasoupclient API is exposed under the mediasoupclient C++ namespace. The library also exposes the nlohmann::json C++ namespace.

The C++ application should also include the required libwebrtc headers.