webrtc代码下载编译

代码下载编译

首先安装depot tools
cd tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ fetch --nohooks webrtc
Running: gclient root
Running: gclient config --spec 'solutions = [
  {
    "name": "src",
    "url": "https://webrtc.googlesource.com/src.git",
    "deps_file": "DEPS",
    "managed": False,
    "custom_deps": {},
  },
]
'
Running: gclient sync --nohooks --with_branch_heads

________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://webrtc.googlesource.com/src.git /home/hui/data/webrtc/_gclient_src_0t7ba_rt' in '/home/hui/data/webrtc'
Cloning into '/home/hui/data/webrtc/_gclient_src_0t7ba_rt'...
remote: Sending approximately 314.44 MiB ...
remote: Total 387724 (delta 287364), reused 387724 (delta 287364)
Receiving objects: 100% (387724/387724), 314.44 MiB | 37.77 MiB/s, done.
Resolving deltas: 100% (287364/287364), done.

通过fetch获取webrtc和直接git clone是一样的。

安装依赖
cd src
./build/install-build-deps.sh
生成Ninja工程文件
$ gn gen out/Default
Done. Made 1466 targets from 294 files in 425ms
编译
ninja -C out/Default
ninja: Entering directory `out/Default'
[1196/6440] CXX obj/net/dcsctp/packet/dcsctp_packet_unittests/init_chunk_test.o
[4625/6440] CXX obj/api/libjingle_peerconnection_api/sctp_transport_interface.o
[6440/6440] STAMP obj/default.stamp

编译AppRTCMobile
$ ninja -C out/Default AppRTCMobile
ninja: Entering directory `out/Default'
ninja: error: unknown target 'AppRTCMobile'

这个是因为fetch的时候选择的分支不是webrtc_android

重新拉代码编译AppRTCMobile

$ mkdir webrtc_android
$ cd webrtc_android
$ fetch --nohooks webrtc_android
$ gclient sync
$ ./build/install-build-deps.sh
$ ./build/install-build-deps-android.sh
$ source build/android/envsetup.sh
$ gn gen out/Debug --args='target_os="android" target_cpu="arm64"'
$ ninja -C out/Debug AppRTCMobile
ninja: Entering directory `out/Debug'
[4089/4089] STAMP obj/examples/AppRTCMobile.stam

默认fetch的webrtc代码后gn gen会报错

$ gn gen out/Debug --args='target_os="android" target_cpu="arm64"'
ERROR at //build/config/android/internal_rules.gni:206:21: Can't load input file.
          deps += [ "$_dep_label$build_config_target_suffix" ]
                    ^---------------------------------------
Unable to load:
  /home/hui/data/webrtc/src/third_party/androidx/BUILD.gn
I also checked in the secondary tree for:
  /home/hui/data/webrtc/src/build/secondary/third_party/androidx/BUILD.gn

原因是webRTC源码,有RTC web的,是默认的,也有RTC android的,还有RTC ios的,默认拉取了web,target_os指定为android就报错了。

参考

  • webRTC Android源码拉取与编译与运行
    https://blog.youkuaiyun.com/newchenxf/article/details/116302993
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值