1

I've tried to cross compile WebRTC for armv7 architecture (AllWinner A20).On www.webrtc.org there are no instructions how to do that, only for Android and IOS, on the internet I've found a few posts how to do that, here is it:

WebRTC building for arm

https://foxdogstudios.com/webrtc-on-linux

https://groups.google.com/forum/#!topic/discuss-webrtc/yzuk8wATMU8

https://github.com/mpromonet/webrtc-streamer/wiki/Cross-compile-WebRTC-for-Raspberry-Pi

All of them written around 2 years ago and starts with command:

gclient config http://webrtc.googlecode.com/svn/trunk

As I understand it's old repository name and also buildsystem is changed for last 2 years. Can anybody help me with complete instruction how to build WebTRC for ARM?

Community
  • 1
  • 1
Pyih
  • 91
  • 2
  • 6
  • Current build procedure is Installing chromium depot_tools and using `fetch`, `gclient` and `ninja` utilities (https://webrtc.org/native-code/development/). To cross-compile, I'd create an ARM chroot environment, because these tools from google (like`ninja`) are poorly documented, so I've got no idea how to configure them properly for a cross-compilation. Have you tried to build a straight i386/amd64 at least before searching for cross? – Velkan Jul 29 '16 at 19:53
  • Its may be some late, but hopefully that tutorial will help you a lot. Visit Reference: [WebRtc_Library_Compilation](https://stackoverflow.com/a/61322971/10413749) – Muhammad Usman Bashir Sep 14 '20 at 18:41

2 Answers2

3

Not best solution to cross-compile WebRTC for ARM platform:

install depot tools and...

mkdir -p web_rtc && cd web_rtc
export GYP_DEFINES="OS=linux"
fetch --nohooks webrtc
gclient sync
cd src
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm
gn gen out/Default --args='target_os="linux" target_cpu="arm"'

## UGLY HACK.
mv webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc.bak
touch webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc

ninja -C out/Default
  • X11 is my problem now ... could you help me ? arm-linux-gnueabihf-g++ -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -B../../third_party/binutils/Linux_x64/Release/bin -fuse-ld=gold -Wl,--icf=all -pthread -Wl,-O1 -Wl,--gc-sections -Wl,--as-needed -Wl,-rpath-link=../Release -Wl,--disable-new-dtags -o "./webrtc_tests" -Wl,--start-group @"./webrtc_tests.rsp" -Wl,--end-group -ldl -lrt -lm -lX11 -lXext -lXcomposite -lXrender -lXcursor -lXdamage -lXfixes -lXi -lXtst ../../third_party/binutils/Linux_x64/Release/bin/ld.gold: error: cannot find -lX11 – M.Hefny Dec 03 '17 at 02:25
  • I used this: gn gen ./out/Release --args='is_debug=false rtc_use_h264=false ffmpeg_branding="Chrome" rtc_include_tests=false is_clang=false target_cpu="arm" treat_warnings_as_errors=false rtc_enable_protobuf=false use_sysroot=false' – M.Hefny Dec 03 '17 at 02:26
  • Did you ever figure the X11 linker errors out? I guess you just need to install a number of cross-compile libraries, but I also would like to know which. ;) – Jonas Witt Jun 10 '19 at 17:08
  • I have tried many solutions on the web, none of it working. With your simple solution I was finally able to build it. Thanks! – Miguel May 02 '20 at 22:30
  • Could you pls tell me if there is certain .o file which is not getting included in built libwebrtc.a then what to do? I am simple doing gn gen out/Default --args='is_debug=false rtc_use_h264=true target_cpu="x64" target_os="linux" clang_use_chrome_plugins=false use_ghash=false symbol_level=2 use_custom_libcxx=false is_component_ffmpeg=true ffmpeg_branding="Chrome" rtc_include_tests=false rtc_build_examples=true rtc_build_tools=false use_rtti=true rtc_enable_protobuf=false rtc_use_h264=true rtc_link_pipewire=true proprietary_codecs=true' and `ninja -C . webrtc` – Yug Singh Jul 17 '20 at 20:20
1

Create a python2 env using conda

$ conda create -n yourenvname python=2.7

Create folder and enter it

$ mkdir webrtc $ cd webrtc

Clone depot tools

$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth 1

Add it to path

$ export PATH=$PATH:/home/ME/webrtc/depot_tools/

Download source .... ALOT of time ans space

$ fetch --nohooks webrtc

$ cd src $ git clean -f

Get the revision you want to compile

$ git ls-remote https://chromium.googlesource.com/external/webrtc --heads branch-heads/72 80865776cf8a1a811166ee005951b7f5b01deacd refs/branch-heads/72 $ gclient sync --force --revision 80865776cf8a1a811166ee005951b7f5b01deacd

$ ./install-build-deps.sh $ gclient runhooks

COMPILE FOR X64

$ gn gen out/x64_72 --args='is_debug=true rtc_include_tests=false treat_warnings_as_errors=false use_rtti=true is_component_build=false enable_iterator_debugging=false is_clang=false use_sysroot=false linux_use_bundled_binutils=false use_custom_libcxx=false use_custom_libcxx_for_host=false target_os="linux" target_cpu="x64"' $ cd ./out/x64_72 $ ninja -C . -j 8

COMPILE FORE ARM64

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

$ gn gen out/arm64_72 --args='is_debug=false enable_iterator_debugging=false treat_warnings_as_errors=false rtc_include_tests=false target_os="linux" target_cpu="arm64" is_clang=true ' $ cd ./out/arm64_72 $ ninja -C . -j 8

Good luck

M.Hefny
  • 2,677
  • 1
  • 26
  • 30