本文主要介绍如何在Linux上交叉编译webrtc-streamer
无需关注编译的同学可直接上github下载编译好的程序使用即可
一、webrtc-streamer源码下载
github地址: https://github.com/mpromonet/webrtc-streamer/tree/master
gitee地址: https://gitee.com/wcg_5/webrtc-streamer/tree/master/想要获取最新的更新,建议还是同步Github上的。Gitee上是滞后于Github
文章来源:https://www.toymoban.com/news/detail-698512.html
- clone仓库源码
$ git clone https://github.com/mpromonet/webrtc-streamer.git
- 切换版本分支
- 本文使用的版本是V0.7.0,由于所依赖的webrtc版本问题,我的设备只能跑V0.7.0及以下的版本,更高的版本无法在我设备上运行,原因是由于所依赖的编译器版本不兼容所导致
- 在执行
$ git submodule update
时如遇到如下错误,请尝试多执行几次,如还不行需检查代理设置确保电脑网络能连上各仓库地址
$ git submodule update
Cloning into ‘/home/qiuhui/work/open_source/webrtc_src/webrtc-streamer-0.7.0/live555helper’…
fatal: unable to access ‘https://github.com/mpromonet/live555helper/’: Failed to connect to github.com port 443: Connection refused
fatal: clone of ‘https://github.com/mpromonet/live555helper’ into submodule path ‘/home/qiuhui/work/open_source/webrtc_src/webrtc-streamer-0.7.0/live555helper’ failed
Failed to clone ‘live555helper’. Retry scheduled文章来源地址https://www.toymoban.com/news/detail-698512.html
$ git tag
...已省略其他版本的输出信息
v0.6.5
v0.7.0
v0.7.1
v0.7.2
v0.8.0
$ git checkout v0.7.0
$ git branch
* (HEAD detached at v0.7.0)
master
$
$ git submodule
-eefb26f82b233268fc98577d265352720d477ba4 civetweb
-4173eb55a74e19e6010c7def2437aad8679112c5 getopt
-066f6e8c48a0afcf76d5a3f9ac1b10fd04253f88 html
-2d162272eaace43c9b54787afdded03d40579e39 libv4l2cpp
-d2b91cc591a1c3ec332ac6b25a4eb97000286e54 live555helper
-4ea303fa66e4c26dc4df67045fa0edf09c2f3077 prometheus-cpp
$
$ git submodule init
Submodule 'civetweb' (https://github.com/civetweb/civetweb) registered for path 'civetweb'
Submodule 'getopt' (https://github.com/kimgr/getopt_port) registered for path 'getopt'
Submodule 'html' (https://github.com/mpromonet/webrtc-streamer-html) registered for path 'html'
Submodule 'libv4l2cpp' (https://github.com/mpromonet/libv4l2cpp) registered for path 'libv4l2cpp'
Submodule 'live555helper' (https://github.com/mpromonet/live555helper) registered for path 'live555helper'
Submodule 'prometheus-cpp' (https://github.com/jupp0r/prometheus-cpp) registered for path 'prometheus-cpp'
$
$ git submodule update
Cloning into '/home/qiuhui/work/open_source/webrtc_src/webrtc-streamer-0.7.0/live555helper'...
fatal: unable to access 'https://github.com/mpromonet/live555helper/': Failed to connect to github.com port 443: Connection refused
fatal: clone of 'https://github.com/mpromonet/live555helper' into submodule path '/home/qiuhui/work/open_source/webrtc_src/webrtc-streamer-0.7.0/live555helper' failed
Failed to clone 'live555helper'. Retry scheduled
Cloning into '/home/qiuhui/work/open_source/webrtc_src/webrtc-streamer-0.7.0/live555helper'...
Submodule path 'civetweb': checked out 'eefb26f82b233268fc98577d265352720d477ba4'
Submodule path 'html': checked out '066f6e8c48a0afcf76d5a3f9ac1b10fd04253f88'
Submodule path 'libv4l2cpp': checked out '2d162272eaace43c9b54787afdded03d40579e39'
Submodule path 'live555helper': checked out 'd2b91cc591a1c3ec332ac6b25a4eb97000286e54'
Submodule path 'prometheus-cpp': checked out '4ea303fa66e4c26dc4df67045fa0edf09c2f3077'
Submodule path 'live555helper': checked out 'd2b91cc591a1c3ec332ac6b25a4eb97000286e54'
二、webrtc编译
- 由于webrtc-streamer编译时需要依赖webrtc库,所以需要先将webrtc编译出来
- webrtc编译: https://blog.csdn.net/qq_15762939/article/details/130623750
三、webrtc-streamer交叉编译
- 确认好GNU工具链版本后开始编译,本文使用的版本号如下
$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cmake -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -DWEBRTCDESKTOPCAPTURE=OFF
$ make
$ ls -l webrtc-streamer
-rwxrwxr-x 1 qiuhui qiuhui 25087768 May 22 00:26 webrtc-streamer
- 在板子端有如下输出信息表示可正常运行
/mnt # ./webrtc-streamer -o
Version:v0.7.0-dirty/Linux-arm64 civetweb@v1.15 webrtc@81d65fcf7d live555helper@d2b91cc
nullLogger level:3
[000:000][4067] (audio_device_pulse_linux.cc:1548): failed to load symbol table
[000:000][4067] (audio_device_pulse_linux.cc:145): failed to initialize PulseAudio
[000:000][4067] (audio_device_impl.cc:341): Audio device initialization failed.
HTTP Listen at 0.0.0.0:8000
到了这里,关于webrtc-streamer下载编译的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!