Chinese Yellow Pages | Classifieds | Knowledge | Tax | IME

Direct compile webrtc on arm64 will fail:

webrtc seems does not support direct support on arm, we will get errors:

Running hooks: 18% ( 4/22) sysroot_arm64
________ running ‘vpython src/build/linux/sysroot_scripts/install-sysroot.py –arch=arm64’ in ‘/webrtcbuilds/out’
Installing Debian sid arm64 root image: /webrtcbuilds/out/src/build/linux/debian_sid_arm64-sysroot
Downloading https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/953c2471bc7e71a788309f6c2d2003e8b703305d/debian_sid_arm64_sysroot.tar.xz
Running hooks: 50% (11/22) binutils
________ running ‘vpython src/third_party/binutils/download.py’ in ‘/webrtcbuilds/out’
Host architecture arm64 is not supported.
Error: Command ‘vpython src/third_party/binutils/download.py’ returned non-zero exit status 1 in /webrtcbuilds/outcross compile for mcu_libs

But fortunately, we can cross-compile it.

 

Cross build using native tools:

libwebtc (c/c++)  currently needs python 2.7 in some of its compile tools,   if you are on debian 10, you need to install python2.

# install cross-compiler ( on any x86_64 debian 10 or container ubuntu 18.04 image )

apt-get install -qy  gcc-8-aarch64-linux-gnu  g++-8-aarch64-linux-gnu  gcc-8-cross-base  libgcc-8-dev-arm64-cross  gcc-8 g++-8

 

then we can following direction from: http://webrtc.github.io/webrtc-org/native-code/development/

 

mkdir -p web_rtc && cd web_rtc

fetch –nohooks webrtc

gclient sync

cd src

./build/linux/sysroot_scripts/install-sysroot.py –arch=arm64

gn gen out/Default –args=’target_os=”linux” target_cpu=”arm64″‘

ninja -C out/Default

 

 

Or Use webrtcbuilds to build full libwebrtc_full.a

git clone https://github.com/vsimon/webrtcbuilds

patch:

it seems has  bug: it includes x64 obj ( protobuf/zlib which is x86_64 obj) for cross-build , causes incompatible at link stage, instead we need to include obj/third_party/protobuf/protobuf_lite.

so need to patch util.sh around line 254

function compile-unix() {

local blacklist=”unittest|examples|/yasm|protobuf_lite|main.o|\
video_capture_external.o|device_info_external.o|x64/obj/”

local extras=$(find \
./obj/third_party/libvpx/libvpx_* \
./obj/third_party/libjpeg_turbo/simd_asm \
./obj/third_party/protobuf/protobuf_lite \
./obj/third_party/boringssl/boringssl_asm -name ‘*.o’)
echo “$extras” | tr ‘ ‘ ‘\n’ >>libwebrtc_full.list

}

build:

./build.sh -n Release  -t linux -c arm64

Reference:

http://webrtc.github.io/webrtc-org/native-code/development/