WebRTC源码编译

举报
媒体服务小助手ultra 发表于 2023/08/03 11:45:44 2023/08/03
【摘要】 ubuntu20.04环境下,代码下载成功并编译成功,过程如下:1、配置boto代理root@rtc-beta-c00484442-0013:/home/webrtc/config# cat http_proxy.boto[Boto]proxy=*****proxy_port=*****proxy_user=*****proxy_pass=***** export NO_AUTH_BOTO_...

ubuntu20.04环境下,代码下载成功并编译成功,过程如下:

1、配置boto代理

root@rtc-beta-c00484442-0013:/home/webrtc/config# cat http_proxy.boto

[Boto]

proxy=*****

proxy_port=*****

proxy_user=*****

proxy_pass=*****

 

export NO_AUTH_BOTO_CONFIG=/home/webrtc/config/http_proxy.boto

 

2、设置环境变量:

export PATH="$PATH:/home/webrtc/depot_tools"

export DEPOT_TOOLS_UPDATE=0

export GYP_DEFINES="OS=linux"

export GYP_DEFINES="OS=android"

 

3、配置au代理:

最好是在~/.bashrc中配置

export http_proxy="http://*****@proxyau.huawei.com:8080"

export https_proxy="http:/*****@proxyau.huawei.com:8080"

export no_proxy=*.huawei.com,10.*.*.*,localhost

 

4、配置host代理ip地址:

root@rtc-beta-c00484442-0013:/home/webrtc/webrtc_linux/src# cat /etc/hosts

172.18.114.32 proxyau.huawei.com

 

5、配置git代理:

git config --global http.proxy http://*****@proxyau.huawei.com:8080

git config --global http.sslVerify=false

git config --global https.proxy https://*****@proxyau.huawei.com:8080

git config --global https.sslVerify=false

 

 

6、下载depot_tools/home/webrtc/depot_tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

 

7、下载webrtc源码,要等待很久很久!!!

fetch --nohooks webrtc

同步代码:gclient sync --nohooks --no-history

 

Android编译

fetch --nohooks webrtc_android

 

8、安装依赖

注意要提前安装apt install lsb-release

 

cd /home/webrtc/webrtc_linux/src

./build/install-build-deps.sh --no-chromeos-fonts

 

安装Android编译依赖

./build/install-build-deps.sh

./build/install-build-deps-android.sh

 

9、生成Ninja工程文件

gn gen out/Default

#或者参数详细点,不过gn工具也可以获取这些信息

gn gen out/Default --args='target_os="linux" target_cpu="arm64"'

 

生产Android编译工程

gn gen out/Default --args='target_os="android" target_cpu="arm"'

 

注意问题解决方案:

build/linux/sysroot_scripts/install-sysroot.py --arch=amd64

python build/util/lastchange.py build/util/LASTCHANGE

 

10、编译

ninja -C out/Default

 

11、产物目录

src/out/Default/obj/libwebrtc.a

 


编译中遇到的问题解决方法如下:

1、跳过安装snap info snapcraft

2、跳过安装Chrome OS fonts.

Installing Chrome OS fonts.

Installing Chrome OS fonts to /usr/local/share/fonts/chromeos.

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- 0:00:43 --:--:-- 0curl: (6) Could not resolve host: commondatastorage.googleapis.com

Traceback (most recent call last):

File "./build/linux/install-chromeos-fonts.py", line 120, in <module>

sys.exit(main(sys.argv[1:]))

File "./build/linux/install-chromeos-fonts.py", line 67, in main

subprocess.check_call(['curl', '-L', url, '-o', tarball])

File "/usr/lib/python2.7/subprocess.py", line 190, in check_call

raise CalledProcessError(retcode, cmd)

subprocess.CalledProcessError: Command '['curl', '-L', 'https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/notofonts-20161129.tar.bz2', '-o', '/usr/local/share/fonts/chromeos/notofonts-20161129.tar.bz2']' returned non-zero exit status 6

ERROR: The installation of the Chrome OS default fonts failed.

This is expected if your repo is installed on a remote file system.

It is recommended to install your repo on a local file system.

You can skip the installation of the Chrome OS default founts with

the command line option: --no-chromeos-fonts.

 

 

3、错误打印如下:

root@rtc-beta-c00484442-0013:/home/webrtc/webrtc_linux/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",

^-----------------------------------

This is where it was set.

See //build/config/linux/pkg_config.gni:5:1: whence it was imported.

import("//build/config/sysroot.gni")

^----------------------------------

See //BUILD.gn:15:1: whence it was imported.

import("//build/config/linux/pkg_config.gni")

^-------------------------------------------

 

解决方案:build/linux/sysroot_scripts/install-sysroot.py --arch=amd64

 

4、错误打印如下:

root@rtc-beta-c00484442-0013:/home/webrtc/webrtc_linux/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/webrtc/webrtc_linux/src/out/Default/

Command: python3 /home/webrtc/webrtc_linux/src/build/compute_build_timestamp.py default

Returned 1.

stderr:

 

Traceback (most recent call last):

File "/home/webrtc/webrtc_linux/src/build/compute_build_timestamp.py", line 126, in <module>

sys.exit(main())

File "/home/webrtc/webrtc_linux/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/webrtc/webrtc_linux/src/build/util/LASTCHANGE.committime'

 

See //base/BUILD.gn:38:1: whence it was imported.

import("//build/timestamp.gni")

^-----------------------------

See //third_party/opus/BUILD.gn:624:7: which caused the file to be included.

"//base",

^-------

 

解决方案:python build/util/lastchange.py build/util/LASTCHANGE

 

 

5、错误打印如下:

root@rtc-beta-c00484442-0013:/home/webrtc/webrtc_linux/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,重新下载同步代码

 




附录:参考链接

https://webrtc.org.cn/mirror/

https://blog.jianchihu.net/linux-webrtc-build.html

https://blog.piasy.com/2017/06/17/out-of-the-box-webrtc-dev-env/index.html

 

【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。