-
Notifications
You must be signed in to change notification settings - Fork 1
Building for Linux and Android
This page describes how to configure a VM to build the WebRtc fork for Linux and Android. It is possible to cross-compile to Windows but that is not supported in this document. We recommend using a Windows VM for building for Windows.
These instructions are tested on a Windows 10 Hyper-V Ubuntu image, though where differences in other images are known they are noted.
- Docker is not supported because snapsd, which is a dependency of install-build-deps-android.sh, does not work in Docker.
- Hyper-V on Windows 10 has a few issues:
- Enhanced Session does not work. The easiest way to complete the tasks below is to
sudo apt install openssh-server
and use Putty to SSH into the VM, then use WinSCP to download the binaries. - The machine by default is put on an internal virtual switch. Create a new virtual switch with mode set to external and set this as the VM's switch to connect to the internet.
- The virtual hard disk size is initially limited to 12GB. Ensure you create it with, or expand it to, to 100GB before beginning.
-
Install a copy of Ubuntu 20.04 (LTS) and configure it with default locale settings.
-
Create a user called
user
-
Uninstall conflicting packages.
-
openjdk-jre > 8
[1] -
sudo apt list --installed | grep jdk
(To check for existing packages)
-
Run
sudo apt-get update
-
Install necessary packages
sudo apt-get install -y git
sudo apt-get install -y curl
sudo apt-get install -y wget
sudo apt-get install -y python2
sudo apt-get install -y python
sudo apt-get install -y openjdk-8-jre-headless
sudo apt-get install -y lsb-core
- Install .NET Core 3.1 SDK using the working instructions
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prod
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1
- Install the Chromium Depot Tools, which manage the Chromium project of which WebRtc is a part.
cd /home/user
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- Add depot tools to the front of the path and append to .bashrc
export PATH=/home/user/depot_tools:$PATH
-
echo "export PATH=/home/user/depot_tools:$PATH" >> ~/.bashrc
[2]
- Fetch WebRTC into webrtc-checkout. This creates the .gclient and src directory, under which the fork can be checked out.)
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks --no-history webrtc
- Perform gclient sync. This will create the initial gclient files.
gclient sync
- Add the Android target OS to the .gclient file and re-sync.
echo "target_os = [ 'android' ]" >> .gclient
cd src
gclient sync
- Install the Android Build Dependencies and run the hooks
build/install-build-deps-android.sh
gclient runhooks
- Fetch the fork over the existing checkout
git remote add ucl https://github.com/UCL-VR/webrtc.git
git fetch ucl
git checkout ucl/ucl-main
- Re-sync (with Delete, as there may be newer dependencies added since the last update to the fork).
gclient sync -D
- Enter the Unity directory.
cd /home/user/webrtc-checkout/src/sdk/dotnet/unity
- Build for (a) Linux or (b) Android
-
dotnet build unity.msbuildproj -property:Targets=LinuxX64
[3] dotnet build unity.msbuildproj -property:Targets=Android
[1] Newer versions of the JRE are sometimes installed on the ISO offered by Canonical.
[2] Todo; stop this actually evaluating whole path into .bashrc
[3] The debug build for Linux exceeds GitHubs file size limit. When building to distribute, build for Release by adding -property:Configuration=Release
to the build command.