JCHub

  • Home
  • Category
    • A/V
    • WebRTC
    • Beauty of Programming
    • Linux
    • Windows
    • Moments of Life
    • Campus Life
  • Reference
    • API Reference
    • Utilities
    • AV Test
    • Doc
  • Message Board
  • About
JCHub
Code as My Sword, Lost in Obsession
  1. Main page
  2. WebRTC
  3. Main content

Mac平台WebRTC编译

2022年12月12日 2499hotness 0likes 1comments

系统要求

  • 磁盘空间:至少5.6 GB磁盘空间(带IOS支持)

准备工作

需要Xcode 9以及以上版本。

对于外网访问,我这里用的是v2rayu,在终端执行如下代理设置:

1
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080

安装depot tools

1
2
3
4
5
6
7
8
9
cd ~
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
 
// 将depot_tools路径加到PATH中
vi ~/.zshrc
# .zshrc添加如下一行
export PATH=$PATH:~/depot_tools
 
source ~/.zshrc

获取代码

1
2
3
4
mkdir webrtc-checkout
cd webrtc-checkout
fetch --nohooks webrtc
gclient sync

如果中间意外中断,执行gclient sync即可。

生成Ninja工程文件

WebRTC默认使用Ninja作为编译系统,Ninja工程文件通过GN生成。

使用如下命令生成默认配置工程(Debug编译,工程文件位于out\Default目录下):

1
gn gen --ide=xcode out/Default

如果需要Release编译,通过如下命令生成工程文件:

1
gn gen --ide=xcode out/Default --args='is_debug=false'

编译

1
ninja -C out/Default

最后在src/out/Default/obj可以看到生成的静态库文件:libwebrtc.a,WebRTC.framework文件以及测试demo:AppRTCMobile。src/out/Default看到all.xcodeproj文件。

代码更新

后续如需要更新代码,按照如下步骤:

1
2
3
git checkout master
git pull origin master
gclient sync

然后参考前面步骤重新生成工程文件,编译即可。

参考

[1] WebRTC Native code Development.https://webrtc.github.io/webrtc-org/native-code/development/.

本文已收录到大话WebRTC专栏,更多精彩请访问《大话WebRTC》。

This article is licensed with Creative Commons Attribution-NonCommercial-No Derivatives 4.0 International License
Tag: WebRTC
Last updated:2023年2月28日

Jeff

管理员——代码为剑,如痴如醉

Tip the author Like
< Last article
Next article >

Comments

  • arya

    macos或者linux怎么调试webrtc呢?

    2023年7月21日
    Reply
  • razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
    Cancel

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    文章目录
    • 系统要求
    • 准备工作
    • 安装depot tools
    • 获取代码
    • 生成Ninja工程文件
    • 编译
    • 代码更新
    • 参考
    Related Posts
    • 浅谈基于SFU实现一对一效果
    • WebRTC资讯:H265支持进展
    • Protected: WebRTC硬件编解码器出错无缝切换软编软解
    • WebRTC研究:Audio level
    • WebRTC研究:RTP时间戳的产生
    Categories

    COPYRIGHT © 2026 jianchihu.net. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang