webrtc-java
webrtc-java copied to clipboard
Build for Raspberry PI
Hi,
First, thanks for your project that was the first straightforward java bridge to WebRTC. I successfully had my code run on OSX an windows but now I would like to test it on Raspberry PI and I hit a roadblock.
The first step for me was to try to build your project on the pi (or on a debian-10 container) but unfortunately without any success.
I tried the following:
- mvn install,
- mvn -Plinux-arm install,
- mvn -Plinux-arm_32 install
I also updated the webrtc-jni pom.xml to point to latest maven-cmake plugin (version 3.22.1-b1) and specifying the cmake.download=False parameter and restarted the 3 tests --> No success either
I looked deeper at what the cmake plugin was doing and recontructed the cmake command line (executed in webrtc-jni) as follow:
cmake -DWEBRTC_BRANCH=branch-heads/4692 -DWEBRTC_SRC_DIR=/buildit/webrtc -DWEBRTC_INSTALL_DIR=/buildit/webrtc/output -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Linux -DTARGET_CPU=arm -S src/main/cpp/ -B target/linux-arm
but this did not work
By any chance, would you have any procedure to build your project for raspberry PI (in a container or on the PI itself directly) ?
Many thanks in advance !
I was able to compile version 0.7.0-SNAPSHOT
successfully, I ran the code on raspberry as well as on Pinephone Mobian and it worked very good. Though my current implementation needs some other optimization but this library works very good.
Following are the changes you have to made in the respective files as well you need to install respective compiler for cross compilation.
As I only needed to compile this library for linux-arm64
so the changes below are only tested on these devices. The cross compiler did work on Ubuntu 20.04
running gcc-9, g++-9
and moreover you will need GLIBC-2.31
(these are my findings for Pinephone)
- install cross compiler
sudo apt install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu libpulse-dev libudev-dev libx11-dev
. The last three libraries are needed only for header files, we will needaarch64
so files for final linking. - create
lib
directory in mainwebrtc-java
directory, downloadlibpulse.so libudev.so libx110.so
foraarch64
and copy these files intolib
directory. You might have to copy other supporting so files too likelibpulse.so.6
. - apply the attached
linux-arm64.patch
patch - during first time, it will fetch all the
webrtc
code, and it will fail for the first time duringWebrtc generate
command. stop the process and execute in/home/{user}/webrtc/src/
directory this commandbuild/linux/sysroot_scripts/install-sysroot.py --arch=arm64
- start again by typing
mvn clean package
.
I hope these 5 steps will yield out a working aarch64 libwebrtc-java.so
file.
linux-arm64.zip
In case anyone wants to use already compiled libwebrtc-java.so
file aarch64
linked against GLIBC-2.3
, please find the attached file.
libwebrtc-java.zip
.