赞
踩
电脑能够科学上网,需要访问Google,虽然国内有很多镜像,但是拉下来参差不齐,浪费时间,建议有条件的还是科学上网吧
电脑要有足够的空间,拉下来的webrtc代码较大,最好预留30G以上
$ export http_proxy=192.168.9.86:9385
$ export https_proxy=192.168.9.86:9385
$
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=$PATH:/home/qiuhui/work/open_source/webrtc_src/depot_tools
$ git config --global http.lowSpeedLimit 0
$ git config --global http.lowSpeedTime 9999999
$ fetch --nohooks webrtc
$ gclient sync
编译的时候一定要选择适合的版本,不同的版本需要的编译器版本也会不一样,到现在我也没找到WebRTC各版本与编译器版本相关的信息和文档,有找到相关信息的同学欢迎留言哈
$ git branch -a
* (HEAD detached at origin/main)
main
remotes/branch-heads/3.50
remotes/branch-heads/3.51
remotes/branch-heads/3.52
remotes/branch-heads/3.53
remotes/branch-heads/3.54
remotes/branch-heads/3.55
remotes/branch-heads/38
remotes/branch-heads/38p
remotes/branch-heads/39
remotes/branch-heads/3984
...后面信息太多,省略掉
如果没有输出以上对应分支(这次我下载下来分支已经有了,无需做这一步操作),请执行以下命令或参考:
https://www.chromium.org/developers/how-tos/get-the-code/working-with-release-branches/
$ gclient sync --with_branch_heads
$ git fetch
$ git branch -r
$ git branch -a
$ git checkout -b m_local refs/remotes/branch-heads/5061
$ gclient sync --with_branch_heads --with_tags
//depot_Tools同时也切到 8b707654318d0b2b24c0b0bbeeef0ee8b0865007
$ git checkout 8b707654318d0b2b24c0b0bbeeef0ee8b0865007
$ ./build/linux/sysroot_scripts/install-sysroot.py --arch=arm64
$ gn gen out/Release --args='rtc_use_x11=false rtc_use_pipewire=false is_clang=true use_sysroot=true target_cpu="arm64" is_chrome_branded=true is_debug=false use_custom_libcxx=false rtc_include_tests=false rtc_enable_protobuf=false rtc_build_examples=false rtc_build_tools=false treat_warnings_as_errors=false rtc_enable_libevent=false rtc_build_libevent=false'
Done. Made 1192 targets from 272 files in 587ms
$
$ ninja -C out/Release webrtc rtc_json jsoncpp builtin_video_decoder_factory builtin_video_encoder_factory peerconnection p2p_server_utils task_queue default_task_queue_factory
ninja: Entering directory `out/Release'
[51/3369] CXX obj/api/audio_codecs/audio_codecs_api/audio_codec_pair_id.o
[3369/3369] AR obj/libwebrtc.a
$
编译webrtc一定要选择合适的版本,特别是交叉编译到板子上跑的,一般都是由于版本不合适导致编译、链接、运行出现各种问题,具体的版本需根据各自的环境去适配。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。