webrtc编译报错以及处理方法合集

642 阅读1分钟

$ mkdir webrtc

$ git clone chromium.googlesource.com/chromium/to…

如果报错如下图

Pasted Graphic.png

原因是未开启翻墙或未设置流量代理

解决办法

一。打开翻墙工具并连接国外服务器代理

二。设置代理流量

执行 git config --global http.proxy "localhost:port"

port替换成自己的端口号

Pasted Graphic 1.png

报错 二

Pasted Graphic 2.png

原因是内存现在不够或者网速不够 

1.解决方法:终端运行

git config --global http.version HTTP/1.1
git config --global http.postBuffer 524288000

翻墙代理改为美国

fetch —help报错如下

Pasted Graphic 3.png

解决方案

查看Python位置   where python2

修改报错处,python2路径改为本机路径 

执行命令 fetch --nohooks webrtc_ios  时报错没有httplib2或者six模块

Pasted Graphic 4.png

Pasted Graphic 5.png

解决办法

安装httplib2

sudo easy_install httplib2

sudo easy_install six

如果包ssl问题则

export http_proxy=http://127.0.0.1:port

export https_proxy=http://127.0.0.1:port

port是自己的网络代理端口号

编译报错

Pasted Graphic 6.png

解决办法:通过使用‘rtc_include_test=false’来解决,即:

gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_component_build=false ios_enable_code_signing=false rtc_include_tests=false' --ide=xcode 

ninja  安装 

$ git clone git://github.com/martine/ninja.git

$ cd ninja/

$ ./configure.py --bootstrap

$ sudo cp ninja /usr/local/bin/

$ sudo chmod a+rx /usr/local/bin/ninja

代码报错 set but not used [-Werror,-Wunused-but-set-variable]

variable ‘zeroGainLvl’ set but not used [-Werror,-Wunused-but-set-variable]

原因:这只是警告,只是clang++编译器将警告当作了错误输出

解决方案:

​ 进入build/config/compile/BUILD.gn文件中,将treat_warnings_as_errors置为false

报错如下

Pasted Graphic.png

替换一下对应的库 目前用的是MacOSX10.15.sdk

fetch 命令失效则重新配置环境变量

export PATH=$PATH:/Users/guochangzheng/Desktop/webrtc/rtc/depot_tools

如果卡着不动则

  1. git config --global http.proxy "localhost:port"
  2. ss开全局,设置环境变量

export http_proxy=http://127.0.0.1:port

export https_proxy=http://127.0.0.1:port

如果Git不能用可以先取消流量代理

git config --global http.proxy ""