Cross compiling libmediasoupclient & mediasoup-broadcaster-demo on RPi (arm64)

Hi,
I have successfully built libwebrtc, libmediasoupclient and mediasoup-broadcaster-demo on a linux device and it works as it is supposed to be. Now I am planning to build a RPi 4 based c++ client using libmediaosupclient which will establish a 2 way communication to a mediasoup cloud server. It is part of a DIY project to build something useful(live streaming / monitoring device maybe for self !) while trying to learning more about cross compiling WebRTC as well as libmediasoupclient.

Advancements until now:
I already am able to cross compile WebRTC for arm64 (as of yesterday) and currently working on cross compiling the mediasoup-broadcaster-demo example where I currently am facing some issues related to cross compile CPR for itā€™s openssl dependencies. The error says

Found *nroff option: ā€“ -man
ā€“ Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY)
CMake Error at build/_deps/cpr-src/opt/curl/CMake/OtherTests.cmake:86 (message):
Unable to link function recv
Call Stack (most recent call first):
build/_deps/cpr-src/opt/curl/CMakeLists.txt:1100 (include)

The course of action I plan is to cross compile libCPR and add it as dependency.

My question in this forum is : Has anyone done something like this before i.e. successfully building a libmediasoupclient based c++ application on RPI4(arm64)? If yes, are there any advice for me to avoid the common mistakes while trying to achieve the target of successfully building a libmediasoupclient based application for a RPi4(arm 64) target?

Thank you very much in advance for reading through my post.

Hello,

Yes, I have! But itā€™s been a while and donā€™t remember having to do anything special for libmediasoupclient on arm64. Since youā€™ve got libwebrtc cross compiled for arm64, I think youā€™re pretty much set.

I only cross compiled libwebrtc. The app, including libmediasoupclient, I directly compiled on the rpi4. So you could just try to do that with mediasoup-broadcaster-demo.

I think I was using Ubuntu 20.04 for rpi4.

Hope this helps!

Thank you for your quick response. I am also trying to run the example of RPI 4. But I am facing some issues while compiling mediaosup-broadcaster demo with a cross compiled libwebrtc for arm64 on RPI 4. It seems to be failing due to C++ library mismatch.
Here is the error.

error: ā€˜is_same_vā€™ is not a member of ā€˜stdā€™; did you mean ā€˜is_sameā€™?

This error seems to be happening due to mismatch between the C++ libraries. I have used the gcc-aarch64-linux-gnu and g+Ā±arch-linux-gnu for crosscompiling the libwebrtc on my ubuntu 20.04 host machine. But while I try to install the above two libraries on the RPI 4, it doesnā€™t install them due to the availability of already installed GCC and G++. While trying to link the mediasoup-broadcaster-demo, it fails on the first encountered file due to difference in the C++ STD library related difference.
Also my RPI OS is the default Raspbian OS, not Ubuntu.

Do you by any chance have the steps with you which you followed to cross compile libwebrtc the last time?

Any other suggestions for me to make the mediaosup-broadcaster-demo example work on RPI 4?

Which libraries? You only need the cross compilers on your x86 machine.

Sorry, I have never tried it on Raspbian OS.

Something like this:

$ gn gen out/arm64/release/ --args='target_cpu="arm64" is_debug=false is_component_build=false is_clang=false rtc_use_h264=true use_rtti=true use_custom_libcxx=false treat_warnings_as_errors=false use_x11=false use_glib=false'
$ ninja -C out/arm64/release
  • Build libwebrtc natively on rpi4 ā€“ might take a while ā€“ use a USB device, not an SD card!
  • Try with Ubuntu

Thank you for a super prompt response.
I am using the arm64 compatible gcc-aarch64-linux-gnu and g+Ā±aarch64-linux-gnu for cross compiling libwebrtc on my x86 machine.
What do you mean by use a usb device not an sd card? Should I run the ubuntu on a usb stick connected with the usb interface rather than having that on the sd card?

Yes, because thereā€™s a huge difference in speed. You can boot directly from USB as well, so no need for an sd card at all.

1 Like

Hi,
It seems we canā€™t use a usb boot method on RPI4 for ubuntu 20.04lts as there are some issues with usb boot. Therefore I have to use a boot options by SD card only. May be I can try with fast sd card but it seems sd car is the only option with ubuntu 20.04. Do you have any idea how you installed the ubuntu 20.04 on a usb device for using it with the RPI 4 ?

Hi,
After downloding the whole webrtc codebase on RPI, it seems the ninja build system is not available for arm64. Therefore, When I try do a

gn gen out/arm64/release/ --args=ā€˜target_cpu=ā€œarm64ā€ is_debug=false is_component_build=false is_clang=false rtc_use_h264=true use_rtti=true use_custom_libcxx=false treat_warnings_as_errors=false use_x11=false use_glib=falseā€™

it fails with some os error pointing me to the linux x86 build system in the src/buildtool/linux64 for gn and ninja. I saw with some google search that, last december the gn and ninjs build system binaries are made available for arm64.

Did you by any chance do anything special for using the gn / ninja build system on arm64?