您当前的位置:首页 > 电脑百科 > 程序开发 > 移动端 > IOS

IOS技术分享|WebRTC iOS源码下载&编译

时间:2021-11-10 11:03:36  来源:  作者:anyRTC云平台

前言

最近对 WebRTC IOS 端源码进行了下载和编译,网上针对 WebRTC iOS 端的编译文章基本都是几年前的,有些地方已经不适用于最新版的 WebRTC 的编译,简单记录下载&编译的过程,以 M93 版本为例。

编译环境

硬件:macBook Pro (Retina, 15-inch, Mid 2015)

系统:macOS Big Sur 11.5

安装 depot_tools

  • depot_tools 是一套 google 用来编译 Chromium 或者 WebRTC 的构建工具,获取 depot_tools 源码前,需开启 VPN 服务。

```

$ mkdir webrtc

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

```

如果出现如下错误,首先检查 VPN 是否连接成功,其次配置 macOS 终端代理

IOS技术分享|WebRTC iOS源码下载&编译

 

配置终端代理

在开启的 VPN 客户端偏好设置中配置信息如下:

IOS技术分享|WebRTC iOS源码下载&编译

 

注意:配置终端代理只对当前终端有用,重启后需要重新配置

```

$ export http_proxy=http://127.0.0.1:10887

$ export https_proxy=http://127.0.0.1:10887

$ export all_proxy=http://127.0.0.1:10887

```

IOS技术分享|WebRTC iOS源码下载&编译

 

配置环境变量

```

$ echo "export PATH=$PWD/depot_tools:$PATH" > $HOME/.bash_profile

$ source $HOME/.bash_profile

```

检查是否配置成功

```

$ echo $PATH

```

安装 ninja

ninja 是 WebRTC 的编译工具。

```

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

$ cd ninja/

$ ./bootstrap.py

```

复制到系统目录(也可配置坏境变量)

```

$ sudo cp ninja /usr/local/bin/

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

```

下载 WebRTC 源码

设置要编译的平台到环境变量

```

$ export GYP_DEFINES="OS=ios"

```

下载源码

```

$ fetch --nohooks webrtc_ios

```

指定分支(以 M93版本为例)

```

$ gclient sync -r 25e3fd53a79bfdb2bd647ee3a199eb9c3a71d271

```

分支版本可以在[Release Notes](
https://github.com/webrtc/webrtc-org/blob/gh-pages/release-notes/index.md)中查找,目前最新的是M95版本。

IOS技术分享|WebRTC iOS源码下载&编译

 

编译 WebRTC 源码

iOS 版本我们可以使用源码中自带的编译脚本,目录如下,不同的 WebRTC 版本路径可能不一样,脚本可根据需求自行配置。

IOS技术分享|WebRTC iOS源码下载&编译

 

```

$ cd /Users/a1/Desktop/webrtc/src

$ /Users/a1/Desktop/webrtc/src/tools_webrtc/ios/build_ios_libs.py

```

编译完成后可在 src/out_ios_libs 目录下找到WebRTC.framework

生成 Example 并运行

```

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

```

下载&编译操作源码

```

Last login: Tue Sep 14 12:49:30 on ttys001

The default interactive shell is now zsh.

To update your account to use zsh, please run `chsh -s /bin/zsh`.

For more details, please visit https://support.Apple.com/kb/HT208050.

yushengzhudeMacBook-Pro:~ a1$ cd /Users/a1/Desktop/webrtc

$ ls

depot_tools

$ export PATH=$PATH:"/Users/a1/Desktop/webrtc/depot_tools"

$ export http_proxy=http://127.0.0.1:10887

$ export https_proxy=http://127.0.0.1:10887

$ export all_proxy=http://127.0.0.1:10887

$ export GYP_DEFINES="OS=ios"

$ fetch --nohooks webrtc_ios

Running: gclient root

WARNING: Your metrics.cfg file was invalid or nonexistent. A new one will be created.

Running: gclient config --spec 'solutions = [

{

"name": "src",

"url": "https://webrtc.googlesource.com/src.git",

"deps_file": "DEPS",

"managed": False,

"custom_deps": {},

},

]

target_os = ["ios"]

'

Running: gclient sync --nohooks --with_branch_heads

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://webrtc.googlesource.com/src.git /Users/a1/Desktop/webrtc/_gclient_src_mgr39v0v' in '/Users/a1/Desktop/webrtc'

Cloning into '/Users/a1/Desktop/webrtc/_gclient_src_mgr39v0v'...

remote: Sending approximately 332.17 MiB ...

remote: Counting objects: 75, done

remote: Finding sources: 100% (75/75)

remote: Total 388264 (delta 284781), reused 388243 (delta 284781)

Receiving objects: 100% (388264/388264), 332.12 MiB | 5.96 MiB/s, done.

Resolving deltas: 100% (284781/284781), done.

[0:01:50] Still working on:

[0:01:50] src

1>Syncing projects: 0% ( 0/ 2)

[0:01:55] Still working on:

[0:01:55] src

Syncing projects: 26% (11/42) src/ios

[0:04:39] Still working on:

[0:04:39] src/third_party

[0:04:39] src/tools

[0:08:52] Still working on:

[0:08:52] src/third_party

[0:08:52] src/tools

Syncing projects: 38% (16/42) src/tools/luci-go:infra/tools/luci/swarming/${pla

[0:09:52] Still working on:

[0:09:52] src/third_party

...

[0:24:17] Still working on:

[0:24:17] src/third_party

Syncing projects: 100% (42/42), done.

Running: git submodule foreach 'git config -f $toplevel/.git/config submodule.$name.ignore all'

Running: git config --add remote.origin.fetch '+refs/tags/*:refs/tags/*'

Running: git config diff.ignoreSubmodules all

$ gclient sync

Syncing projects: 100% (42/42), done.

Running hooks: 41% (10/24) mac_toolchain

________ running 'vPython src/build/mac_toolchain.py' in '/Users/a1/Desktop/webrtc'

Skipping Mac toolchain installation for mac

Running hooks: 45% (11/24) clang

________ running 'vpython src/tools/clang/scripts/update.py' in '/Users/a1/Desktop/webrtc'

Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-llvmorg-14-init-2175-g945cde8b-1.tgz .......... Done.

Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-llvmorg-14-init-2175-g945cde8b-1.tgz .......... Done.

Hook 'vpython src/tools/clang/scripts/update.py' took 30.90 secs

Running hooks: 58% (14/24) clang_format_mac

________ running 'download_from_google_storage --no_resume --platform=darwin --no_auth --bucket chromium-clang-format -s src/buildtools/mac/clang-format.sha1' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

0> Downloading src/buildtools/mac/clang-format@5ba974b3b37f9f4e3b44fdde11d7ef2ab71619ab...

Downloading 1 files took 25.228423 second(s)

Hook 'download_from_google_storage --no_resume --platform=darwin --no_auth --bucket chromium-clang-format -s src/buildtools/mac/clang-format.sha1' took 25.33 secs

Running hooks: 79% (19/24) test_fonts

________ running 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

0> Downloading src/third_party/test_fonts/test_fonts.tar.gz@cd96fc55dc243f6c6f4cb63ad117cad6cd48dceb...

0> Extracting 33 entries from src/third_party/test_fonts/test_fonts.tar.gz to src/third_party/test_fonts/test_fonts

Downloading 1 files took 25.751998 second(s)

Hook 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' took 25.84 secs

Running hooks: 91% (22/24)

________ running 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

Hook 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' took 1268.21 secs

Hook 'vpython src/testing/generate_location_tags.py --out src/testing/location_tags.json' took 34.77 secs

Running hooks: 100% (24/24), done.

$ gclient sync -r 25e3fd53a79bfdb2bd647ee3a199eb9c3a71d271

Syncing projects: 100% (43/43), done.

Running hooks: 41% (10/24) mac_toolchain

________ running 'vpython src/build/mac_toolchain.py' in '/Users/a1/Desktop/webrtc'

Skipping Mac toolchain installation for mac

Running hooks: 45% (11/24) clang

________ running 'vpython src/tools/clang/scripts/update.py' in '/Users/a1/Desktop/webrtc'

Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-llvmorg-13-init-14732-g8a7b5ebf-2.tgz .......... Done.

Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-llvmorg-13-init-14732-g8a7b5ebf-2.tgz .......... Done.

Hook 'vpython src/tools/clang/scripts/update.py' took 31.97 secs

Running hooks: 58% (14/24) clang_format_mac

________ running 'download_from_google_storage --no_resume --platform=darwin --no_auth --bucket chromium-clang-format -s src/buildtools/mac/clang-format.sha1' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

Running hooks: 79% (19/24) test_fonts

________ running 'download_from_google_storage --no_resume --extract --no_auth --bucket chromium-fonts -s src/third_party/test_fonts/test_fonts.tar.gz.sha1' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

Running hooks: 91% (22/24)

________ running 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' in '/Users/a1/Desktop/webrtc'

NOTICE: You have PROXY values set in your environment, but gsutilin depot_tools does not (yet) obey them.

Also, --no_auth prevents the normal BOTO_CONFIG environmentvariable from being used.

To use a proxy in this situation, please supply those settingsin a .boto file pointed to by the NO_AUTH_BOTO_CONFIG environmentvariable.

Hook 'vpython src/testing/generate_location_tags.py --out src/testing/location_tags.json' took 35.13 secs

Running hooks: 100% (24/24), done.

```

IOS技术分享|WebRTC iOS源码下载&编译

 



Tags:WebRTC iOS   点击:()  评论:()
声明:本站部分内容及图片来自互联网,转载是出于传递更多信息之目的,内容观点仅代表作者本人,如有任何标注错误或版权侵犯请与我们联系(Email:2595517585@qq.com),我们将及时更正、删除,谢谢。
▌相关推荐
前言最近对 WebRTC iOS 端源码进行了下载和编译,网上针对 WebRTC iOS 端的编译文章基本都是几年前的,有些地方已经不适用于最新版的 WebRTC 的编译,简单记录下载&编译的过程,以...【详细内容】
2021-11-10  Tags: WebRTC iOS  点击:(38)  评论:(0)  加入收藏
▌简易百科推荐
前言最近对 WebRTC iOS 端源码进行了下载和编译,网上针对 WebRTC iOS 端的编译文章基本都是几年前的,有些地方已经不适用于最新版的 WebRTC 的编译,简单记录下载&编译的过程,以...【详细内容】
2021-11-10  anyRTC云平台    Tags:WebRTC iOS   点击:(38)  评论:(0)  加入收藏
IT之家 10 月 20 日消息,据 9to5 Mac 报道,继 iOS 15.1 RC、macOS Monterey RC 和其他更新发布后,苹果也向开发者提供了 Xcode 13.1 RC(候选版)。最新版本的 Xcode 现在可以在苹...【详细内容】
2021-10-20    IT之家  Tags:Xcode   点击:(87)  评论:(0)  加入收藏
IT之家 8 月 12 日消 苹果今日发布了一款新的开发者工具,旨在强制那些运行 iOS 15 和 iPadOS 15 的设备在使用不安全的 WiFi 网络或 WiFi 速度较慢时优先使用 5G 连接而不是...【详细内容】
2021-08-12    IT之家  Tags: iOS   点击:(151)  评论:(0)  加入收藏
IT之家4月7日消息 去年底,苹果公司要求应用商店所有第三方软件都必须增加 “隐私标签”以进一步保护消费者隐私安全。之后,谷歌旗下大量 iOS 软件长时间停止更新。而到了今年...【详细内容】
2021-04-07    IT之家  Tags:苹果隐私标签   点击:(309)  评论:(0)  加入收藏
你们好,这里是Seek思科,为你寻找苹果最新资讯、苹果隐藏技巧、苹果良心APP以及苹果优质配件。如果你需要这些,不妨点个关注。苹果已经官宣今年全球开发者大会将在北京时间6月8...【详细内容】
2021-04-02  Seek思科  今日头条  Tags:iOS15系统   点击:(368)  评论:(0)  加入收藏
Sideloadly安装unc0ver越狱 今天推荐比Altstore更简单的安装工具,Sideloadly 在QQ群文件下载最新版本安装, 然后直接打开,演示是Mac版本 Win是一模一样的, 不会出现报错2或...【详细内容】
2021-03-30  CydiaInstaller  今日头条  Tags:iOS自签名   点击:(1272)  评论:(0)  加入收藏
就在昨日,苹果对《App Store 审核指南》进行了2021年的首次重大更新。而此次更新主要是为了方便开发者为即将发布的OS版本中的新功能提供支持,更好地保护用户,并帮助开发者的Ap...【详细内容】
2021-02-03      Tags:App Store   点击:(205)  评论:(0)  加入收藏
不用不上架、不越狱、不要企业证书、永不掉签 只需一个h5网站地址 就能创建属于您自己的苹果IOS APP_多啦咪资源网无需越狱 无需企业证书 不用上架appStore 界面全屏 无广告...【详细内容】
2020-12-11      Tags:APP   点击:(177)  评论:(0)  加入收藏
iOS14支持把小组件添加到桌面,不过我们之前推荐的都是一些工具类的或者是桌面美化类的小组件,今天我们来看看目前有哪些我们常用的App已经支持把小组件添加到桌面了。 网易云...【详细内容】
2020-11-26      Tags:iOS   点击:(185)  评论:(0)  加入收藏
简介: 在平时的面试中,经常问到的高频面试题大概做了一个总结,希望能帮到你!一、如何绘制UIView?绘制一个UIView最灵活的方法就是由它自己完成绘制。实际上你不是绘制一个UIView...【详细内容】
2020-11-13      Tags:iOS   点击:(146)  评论:(0)  加入收藏
相关文章
    无相关信息
最新更新
栏目热门
栏目头条