/ home / Documentation / v3 / libmediasoupclient / Installation

libmediasoupclient v3 Installation


Build libwebrtc

libmediasoupclient makes use of libwebrtc. Follow the official instructions to build it and make sure the branch m73 or m74 is checked-out and compiled.

Future versions of libmediasoupclient will include a more recent version of libwebrtc. For now, supported bersions are m73 and m74 branch.

Build libmediasoupclient

Get the libmediasoupclient sources via git and check-out the branch v3:

$ git clone
$ cd libmediasoupclient/
$ git checkout v3

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/mybuild-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 Example

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

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

$ make -C build/

Please, check the official instructions to build libwebrtc and do NOT take this example as a reference.


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.