XAMARIN WEBRTC COMPLINING THE NATIVE IOS LIBRARY

Paula Aliu
Xamarin WebRTC
Published in
4 min readSep 1, 2020

--

COMPILING THE iOS WEBRTC LIBRARY

1. Tools used in this articles project:

Tools used for this tutorial

2. Preliminary expectations:

To follow this tutorial, you must be working with either an Apple computer with MacOS installed or you are working with a MacOS virtual machine. I personally used MacOS Catalina version 10.15 and I have implemented this tutorial in MacOS Catalina 10.13 so I can personally vouch for both version of MacOS. I also expect you have installed and setup GitHub for Desktop and Visual studio code.

3. Setting up Chromium depot tools:

Chromium depot tools(depot_tools) is in its essence a folder containing tools, scripts and other things needed to build a host of google libraries with the Google WebRTC library being one of them. For this tutorial, we will be using fetch and gclient primarily. Following the Chromium Depot Tools Set Up link above for Linux Systems should work without issue. But for minimal errors. Using the GitHub Desktop application, clone the repository below:

https://chromium.googlesource.com/chromium/tools/depot_tools.git

Take note of the path for the depot_tools folder.

4. Getting the Google WebRTC source code:

Open a new Folder when you start Visual Studio Code. Once done, open a new terminal inside visual studio code. Add the depot_tools path to your environment variables using the following command:

export PATH=$PATH:/{path to depot_tools}/depot_tools

export PATH=$PATH:/{path to depot_tools}/depot_tools

Check to make sure the depot_tools path has been added by typing:

echo $PATH

echo $PATH
POST-Execution of echo $PATH

Once this is done, we can begin with the real work. In the same terminal, type in the following command to fetch the WebRTC source code for android specifically:

fetch –nohooks webrtc_ios

fetch –nohooks webrtc_ios
POST-Execution: fetch –nohooks webrtc_ios

This will take some time, after this is done, type the following command:

gclient async

This also takes some time which is dependent on your internet speed. With this done, in the current directory there should be a folder titled src, this is folder you will find all the necessary things needed for compiling the android library. Once this is done, cd into the src folder:

cd src

then execute the following command to compile the iOS library:

python ./tools_webrtc/ios/build_ios_libs.py

python ./tools_webrtc/ios/build_ios_libs.py
python ./tools_webrtc/ios/build_ios_libs.py

Abhijith Cr posted a workaround should you encounter an error when compling with the latest clang version (circa September 2020): Workaround was to use the google clang instead using this command — python ./tools_webrtc/ios/build_ios_libs.py — extra-gn-args use_xcode_clang=false

This will compile for all valid and supported architectures: arm64, arm, x64 and x86 once each is compiled, it will then package all of the libraries into a WebRTC.framework folder which can be found in the src/out_ios_libs folder.

out_ios_libs folder
WebRTC.framework folder

For Non-Xamarin Developers i.e. Native iOS developers:

Please note that you cannot ship the FAT framework binary with your app if you intend to distribute it through the app store. To solve this either remove “x86–64” from the list of architectures in the build script or split the binary and recreate it without x86–64. For instructions on how to do this see here

--

--