IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 移动开发 -> IOS技术分享| WebRTC iOS源码下载&编译 -> 正文阅读

[移动开发]IOS技术分享| WebRTC iOS源码下载&编译

前言

最近对 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 终端代理

deport_tools

配置终端代理

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

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

$ 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

depot_tools

配置环境变量

$ 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中查找,目前最新的是M95版本。

M93

编译 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.

在这里插入图片描述

  移动开发 最新文章
Vue3装载axios和element-ui
android adb cmd
【xcode】Xcode常用快捷键与技巧
Android开发中的线程池使用
Java 和 Android 的 Base64
Android 测试文字编码格式
微信小程序支付
安卓权限记录
知乎之自动养号
【Android Jetpack】DataStore
上一篇文章      下一篇文章      查看所有文章
加:2021-11-10 12:30:55  更:2021-11-10 12:31:20 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/24 3:40:20-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码