国内编译webrtc是真的不容易,找了几个国内的镜像,说是可以编译下载webrtc,但是试了下其实不行,都有各种问题,还是需要能够访问外网的机器才行.我编译webtrc的机器是x86-64 ubuntu20.04.
1.下载代码
mkdir webrtc_checkout
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PWD/depot_tools:$PATH
cd webrtc_checkout
fetch --nohooks webrtc
#用于中断后继续下载
gclient sync
最好是一次下载完,下载完后用这个命令多试几次? gclient sync --nohooks --no-history.
2.下载依赖:
cd webrtc_checkout/src
./build/install-build-deps.sh
可能需要替换源:
用
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial main universe
替换
deb http://security.ubuntu.com/ubuntu xenial-security main
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe
继续执行
./build/install-build-deps.sh --no-chromeos-fonts 后面的也可以不加
3.构建项目
gn gen out/Default
我这里就有几个报错:
1.webrtc-checkout/src$ gn gen out/Default
ERROR at //build/config/sysroot.gni:64:7: Assertion failed.
assert(
^-----
Missing sysroot (//build/linux/debian_sid_amd64-sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
See //build/config/sysroot.gni:65:11:
exec_script("//build/dir_exists.py",
----------------------------------------------------------------------
2.webrtc-checkout/src$ gn gen out/Default
ERROR at //build/timestamp.gni:31:19: Script returned non-zero exit code.
build_timestamp = exec_script(compute_build_timestamp,
^----------
Current dir: /home/yanzhl/Workspace/p2p_work/webrtc-checkout/src/out/Default/
Command: python3 /home/yanzhl/Workspace/p2p_work/webrtc-checkout/src/build/compute_build_timestamp.py default
Returned 1.
stderr:
Traceback (most recent call last):
File "/home/yanzhl/Workspace/p2p_work/webrtc-checkout/src/build/compute_build_timestamp.py", line 126, in <module>
sys.exit(main())
File "/home/yanzhl/Workspace/p2p_work/webrtc-checkout/src/build/compute_build_timestamp.py", line 112, in main
last_commit_timestamp = int(open(lastchange_file).read())
FileNotFoundError: [Errno 2] No such file or directory: '/home/yanzhl/Workspace/p2p_work/webrtc-checkout/src/build/util/LASTCHANGE.committime'
第一个报错按照提示执行命令
build/linux/sysroot_scripts/install-sysroot.py --arch=amd64
第二个报错
python ./build/util/lastchange.py ./build/util/LASTCHANGE
再次执行:gn gen out/Default完成构建.
4.编译
ninja -C out/Default
报错:
1.webrtc-checkout/src$ ninja -C out/Default
ninja: Entering directory `out/Default'
ninja: error: '../../resources/audio_processing/test/py_quality_assessment/noise_tracks/city.wav', needed by 'py_quality_assessment/noise_tracks/city.wav', missing and no known rule to make it
需要执行:gclient sync
再次构建编译成功
|