webRTC之macOS编译过程及问题解决

1 篇文章 0 订阅
1 篇文章 0 订阅

本文描述的是macOS下编译webRTC frmework的过程及编译过程中遇到的问题,并提供解决方案

步骤

  1. 安装depot_tools,配置环境变量

    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    export PATH=$PATH:/Users/suntongmian/Documents/develop/webrtc/depot_tools
    
  2. 下载WebRTC源码

    #cd 到希望放置源代码的目录 执行以下命令
    fetch --nohooks webrtc_ios
    #执行完毕上面命令后
    gclient sync
    
  3. 编译WebRTC

    gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_debug=true'
    ninja -C out/ios framework_objc
    或
    gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_debug=true'
    python tools_webrtc/ios/build_ios_libs.py --bitcode
    
    #执行完毕后可以在src/out/ios目录中看到生成的项目工程
    

问题记录

1. Exception: No 10.12+ SDK found

Traceback (most recent call last):

File “/Users/zhouyongchao/Documents/WorkingSpaces/webrtc_build/webrtc/src/build/mac/find_sdk.py”, line 127, in

print(main())

File “/Users/zhouyongchao/Documents/WorkingSpaces/webrtc_build/webrtc/src/build/mac/find_sdk.py”, line 96, in main

raise Exception(‘No %s+ SDK found’ % min_sdk_version)

Exception: No 10.12+ SDK found

解决方案:

  1. 通过命令xcrun --show-sdk-version可以知道当前SDK的版本
  2. 修改.gn文件的mac_sdk_min选项为当前系统版本:如:11.0
  3. 打开find_sdk.py阅读代码发现了只支持10.xx的系统,修改11即可
2. LASTCHANGE.committime

Traceback (most recent call last):

File “/Users/zhouyongchao/Documents/WorkingSpaces/webrtc_build/webrtc/src/build/compute_build_timestamp.py”, line 127, in

sys.exit(main())

File “/Users/zhouyongchao/Documents/WorkingSpaces/webrtc_build/webrtc/src/build/compute_build_timestamp.py”, line 113, in main

last_commit_timestamp = int(open(lastchange_file).read())

IOError: [Errno 2] No such file or directory: ‘/Users/zhouyongchao/Documents/WorkingSpaces/webrtc_build/webrtc/src/build/util/LASTCHANGE.committime’

解决方案:

在src目录执行./build/util/lastchange.py build/util/LASTCHANGE

3. gn gen out/ios --args='target_os=“ios” target_cpu=“arm64” is_debug=true’报错

Automatic code signing identity selection was enabled but could

not find exactly one code signing identity matching

iPhone Developer. Check that your keychain

is accessible and that there is a valid code signing identity

listed by xcrun security find-identity -v -p codesigning

TIP: Simulator builds don’t require code signing…

解决方案:

  1. 打开src/build/config/ios/ios_sdk.gni文件,把ios_code_signing_identity_description="iPhone Develoer"修改为ios_code_signing_identity_description="Apple Development"
  2. 如果方法1不生效,可以尝试把命令更改为gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_component_build=false ios_enable_code_signing=false' --ide=xcode
编译APP报错

/bin/sh: …/…/third_party/llvm-build/Release+Asserts/bin/clang++: No such file or directory

解决方案:手动到官网https://commondatastorage.googleapis.com/chromium-browser-clang/index.html下载clang++,放到相应的文件夹(src/third_party/llvm-build/Release+Asserts)下面,注意clang++和macOS的版本对应问题

代码报错 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

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值