编译webrtc demo ios平台

已经编译过的代码地址 :https://github.com/starmier/SMWebRTC

1. 下载工具

1.1 下载 depot_tools

hjsddeMacBook-Pro:webrtc starmier$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools
Cloning into 'depot_tools'...
remote: Sending approximately 27.10 MiB ...
remote: Total 35211 (delta 24488), reused 35211 (delta 24488)
Receiving objects: 100% (35211/35211), 27.10 MiB | 461.00 KiB/s, done.
Resolving deltas: 100% (24488/24488), done.
hjsddeMacBook-Pro:webrtc starmier$ pwd

1.2 配置 depot_tools 环境

hjsddeMacBook-Pro:depot_tools starmier$ pwd
/MYPROJECT/webrtc/depot_tools
hjsddeMacBook-Pro:depot_tools starmier$ export PATH=$PATH:/MYPROJECT/webrtc/depot_tools
hjsddeMacBook-Pro:depot_tools starmier$ fetch --help
usage: fetch.py [options] <config> [--property=value [--property2=value2 ...]]

This script can be used to download the Chromium sources. See
http://www.chromium.org/developers/how-tos/get-the-code
for full usage instructions.

Valid options:
   -h, --help, help   Print this message.
   --nohooks          Don't run hooks after checkout.
   --force            (dangerous) Don't look for existing .gclient file.
   -n, --dry-run      Don't run commands, only print them.
   --no-history       Perform shallow clones, don't fetch the full git history.

Valid fetch configs:
  android
  android_internal
  breakpad
  chromium
  config_util
  crashpad
  dart
  depot_tools
  goma_client
  gyp
  infra
  infra_internal
  inspector_protocol
  ios
  ios_internal
  nacl
  naclports
  node-ci
  pdfium
  skia
  skia_buildbot
  syzygy
  v8
  webrtc
  webrtc_android
  webrtc_ios
hjsddeMacBook-Pro:depot_tools starmier$

1.3 下载源码,下载成功后的文件在一个自动生成的src目录下面(这个下载特别就,用了4个小时)

hjsddeMacBook-Pro:webrtc starmier$ 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 = [
  {
    "url": "https://webrtc.googlesource.com/src.git",
    "managed": False,
    "name": "src",
    "deps_file": "DEPS",
    "custom_deps": {},
  },
]
target_os = ["ios", "mac"]
'
Running: gclient sync --nohooks --with_branch_heads
1>________ running 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress https://webrtc.googlesource.com/src.git /MYPROJECT/webrtc/_gclient_src_iW0YLg' in '/MYPROJECT/webrtc'
1>Cloning into '/MYPROJECT/webrtc/_gclient_src_iW0YLg'...
1>remote: Sending approximately 252.62 MiB ...        
1>Receiving objects:  10% (33799/336896), 14.06 MiB | 456.00 KiB/s


......

[4:13:10] Still working on:
[4:13:10]   src/third_party/icu

[4:13:20] Still working on:
[4:13:20]   src/third_party/icu

[4:13:30] Still working on:
[4:13:30]   src/third_party/icu

[4:13:40] Still working on:
[4:13:40]   src/third_party/icu

[4:13:50] Still working on:
[4:13:50]   src/third_party/icu

[4:13:53] Still working on:
[4:13:53]   src/third_party/icu
Syncing projects: 100% (38/38), 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

2. 与远端 repo 进行代码同步,在终端执行命令。这条命令执行时,要下载的文件比较多,需要耐心等待命令的执行结果。(我用了大概半个多种)

hjsddeMacBook-Pro:webrtc starmier$ gclient sync
Syncing projects: 100% (38/38), done.                                           
Running hooks:  45% (10/22) mac_toolchain                 
________ running 'vpython src/build/mac_toolchain.py' in '/MYPROJECT/webrtc'
Skipping Mac toolchain installation for mac
Running hooks:  54% (12/22) clang        
________ running 'vpython src/tools/clang/scripts/update.py' in '/MYPROJECT/webrtc'
Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-373424-64a362e7-1.tgz .......... Done.
Hook 'vpython src/tools/clang/scripts/update.py' took 62.36 secs
Running hooks:  68% (15/22) 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 '/MYPROJECT/webrtc'
0> Downloading src/buildtools/mac/clang-format...
Downloading 1 files took 41.859609 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 41.99 secs
Running hooks: 100% (22/22)                     
________ running 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' in '/MYPROJECT/webrtc'
4> Downloading src/resources/foreman_320x240.yuv...
7> Downloading src/resources/e2e_audio_in.pcm...
0> Downloading src/resources/far44_stereo.pcm...
1> Downloading src/resources/foreman_240x136.yuv...
6> Downloading src/resources/ref03.aecdump...
9> Downloading src/resources/foreman_cif.yuv...
2> Downloading src/resources/far8_stereo.pcm...
8> Downloading src/resources/speech_and_misc_wb.pcm...
5> Downloading src/resources/near44_stereo.pcm...
3> Downloading src/resources/foreman_480x272.yuv...
2> Downloading src/resources/google-wifi-3mbps.rx...
7> Downloading src/resources/web_screenshot_1850_1110.yuv...
0> Downloading src/resources/reference_less_video_test_file.y4m...
5> Downloading src/resources/att-uplink.rx...
2> Downloading src/resources/foreman_cif_short.yuv...
5> Downloading src/resources/near48_stereo.pcm...
8> Downloading src/resources/near32_stereo.pcm...
7> Downloading src/resources/near16_stereo.pcm...
8> Downloading src/resources/paris_qcif.yuv...
5> Downloading src/resources/ConferenceMotion_1280_720_50.yuv...
7> Downloading src/resources/foreman_176x144.yuv...
6> Downloading src/resources/foreman_160x120.yuv...
2> Downloading src/resources/far32_stereo.pcm...
2> Downloading src/resources/far48_stereo.pcm...
6> Downloading src/resources/short_mixed_stereo_48.pcm...
2> Downloading src/resources/short_mixed_stereo_48.dat...
2> Downloading src/resources/near8_stereo.pcm...
6> Downloading src/resources/far16_stereo.pcm...
2> Downloading src/resources/foremanColorEnhanced_cif_short.yuv...
6> Downloading src/resources/FourPeople_1280x720_30.yuv...
1> Downloading src/resources/short_mixed_mono_48_arm.dat...
1> Downloading src/resources/presentation_1850_1110.yuv...
2> Downloading src/resources/pc_quality_smoke_test_alice_source.wav...
7> Downloading src/resources/photo_1850_1110.yuv...
1> Downloading src/resources/pc_quality_smoke_test_bob_source.wav...
2> Downloading src/resources/att-downlink.rx...
1> Downloading src/resources/short_mixed_mono_48.dat...
1> Downloading src/resources/difficult_photo_1850_1110.yuv...
7> Downloading src/resources/short_mixed_mono_48.pcm...
7> Downloading src/resources/foreman_128x96.yuv...
1> Downloading src/resources/reference_video_640x360_30fps.y4m...
2> Downloading src/resources/deflicker_before_cif_short.yuv...
7> Downloading src/resources/images/renderStartImage.jpg...
7> Downloading src/resources/images/captureDeviceImage.jpg...
7> Downloading src/resources/images/webrtc_logo.jpg...
7> Downloading src/resources/images/renderTimeoutImage.jpg...
7> Downloading src/resources/video_engine/renderStartImage.jpg...
7> Downloading src/resources/video_engine/renderTimeoutImage.jpg...
7> Downloading src/resources/video_coding/frame-loopback.pcap...
7> Downloading src/resources/video_coding/frame-ethernet-ii.pcap...
7> Downloading src/resources/video_coding/ssrcs-3.pcap...
7> Downloading src/resources/video_coding/pltype103.rtp...
7> Downloading src/resources/video_coding/pltype103_header_only.rtp...
7> Downloading src/resources/video_coding/ssrcs-2.pcap...
2> Downloading src/resources/audio_device/audio_short44.pcm...
7> Downloading src/resources/audio_device/audio_short8.pcm...
7> Downloading src/resources/audio_device/audio_short48.pcm...
2> Downloading src/resources/audio_device/audio_short16.pcm...
4> Downloading src/resources/audio_coding/music_stereo_48kHz.pcm...
2> Downloading src/resources/audio_coding/F01.INP...
7> Downloading src/resources/audio_coding/F00.INP...
2> Downloading src/resources/audio_coding/F03.OUT30...
7> Downloading src/resources/audio_coding/F01.OUT20...
2> Downloading src/resources/audio_coding/speech_mono_16kHz.pcm...
7> Downloading src/resources/audio_coding/testfile32kHz.pcm...
7> Downloading src/resources/audio_coding/clean.chn...
7> Downloading src/resources/audio_coding/F01.BIT30...
7> Downloading src/resources/audio_coding/neteq_universal_new.rtp...
2> Downloading src/resources/audio_coding/F03.BIT20...
2> Downloading src/resources/audio_coding/F01.OUT30...
2> Downloading src/resources/audio_coding/F03.OUT20...
2> Downloading src/resources/audio_coding/F03.BIT30...
2> Downloading src/resources/audio_coding/F01.BIT20...
2> Downloading src/resources/audio_coding/testfile_fake_stereo_32kHz.pcm...
8> Downloading src/resources/audio_coding/neteq_opus.rtp...
7> Downloading src/resources/audio_coding/F00.BIT30...
7> Downloading src/resources/audio_coding/F02.BIT20...
7> Downloading src/resources/audio_coding/speech_4_channels_48k_one_second.wav...
2> Downloading src/resources/audio_coding/F02.OUT30...
8> Downloading src/resources/audio_coding/F02.INP...
7> Downloading src/resources/audio_coding/F03.INP...
2> Downloading src/resources/audio_coding/F00.OUT20...
9> Downloading src/resources/audio_coding/neteq_opus_dtx.rtp...
8> Downloading src/resources/audio_coding/speech_mono_32_48kHz.pcm...
7> Downloading src/resources/audio_coding/F02.BIT30...
2> Downloading src/resources/audio_coding/F00.BIT20...
9> Downloading src/resources/audio_coding/teststereo32kHz.pcm...
2> Downloading src/resources/audio_coding/F00.OUT30...
7> Downloading src/resources/audio_coding/F02.OUT20...
2> Downloading src/resources/audio_processing/output_data_float.pb...
7> Downloading src/resources/audio_processing/output_data_mac.pb...
9> Downloading src/resources/audio_processing/output_data_fixed.pb...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script1_M_sp1_A1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script1_M_sp1_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_B2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_A2.wav...
4> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_B3.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_A3.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_B2.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_B3.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_A1.wav...
4> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/breathing_M_sp1_1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/breathing_F_sp2_2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script1_F_sp1_A2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp1_B2.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp2_A1.wav...
4> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_A4.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_B4.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script1_F_sp1_B1.wav...
4> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp1_A1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp2_B2.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_B4.wav...
3> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_A1.wav...
1> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_A2.wav...
4> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_B2.wav...
9> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_A3.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_B3.wav...
3> Downloading src/resources/audio_processing/conversational_speech/breathing_F_sp1_1.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_A1.wav...
1> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/SE_script1_M_sp1_B2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script1_M_sp1_A2.wav...
4> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_B4.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_A4.wav...
4> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp2_A2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/breathing_F_sp2_1.wav...
3> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp1_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/SE_script1_F_sp1_A1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_A4.wav...
4> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_A2.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_A3.wav...
1> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_B2.wav...
3> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_B1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_B3.wav...
4> Downloading src/resources/audio_processing/conversational_speech/breathing_M_sp1_2.wav...
9> Downloading src/resources/audio_processing/conversational_speech/breathing_M_sp1_3.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_A1.wav...
1> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script1_M_sp1_B2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script1_M_sp1_A2.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_A4.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_B4.wav...
2> Downloading src/resources/audio_processing/conversational_speech/EN_script1_M_sp1_A1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/SE_script1_M_sp1_B1.wav...
4> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_A2.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_B2.wav...
3> Downloading src/resources/audio_processing/conversational_speech/EN_script2_M_sp1_B3.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script2_M_sp1_A3.wav...
4> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_B1.wav...
3> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_A1.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_A2.wav...
1> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp2_A3.wav...
3> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp2_B1.wav...
7> Downloading src/resources/audio_processing/conversational_speech/EN_script1_F_sp1_A2.wav...
9> Downloading src/resources/audio_processing/conversational_speech/EN_script2_F_sp1_A4.wav...
2> Downloading src/resources/audio_processing/conversational_speech/SE_script1_F_sp1_B2.wav...
3> Downloading src/resources/audio_processing/conversational_speech/SE_script2_F_sp1_B4.wav...
7> Downloading src/resources/audio_processing/test/py_quality_assessment/noise_tracks/city.wav...
2> Downloading src/resources/audio_processing/test/py_quality_assessment/probing_signals/tone-880.wav...
9> Downloading src/resources/audio_processing/agc2/rnn_vad/pitch_search_int.dat...
3> Downloading src/resources/audio_processing/agc2/rnn_vad/samples.pcm...
9> Downloading src/resources/audio_processing/agc2/rnn_vad/pitch_lp_res.dat...
4> Downloading src/resources/audio_processing/agc2/rnn_vad/vad_prob.dat...
1> Downloading src/resources/audio_processing/agc2/rnn_vad/band_energies.dat...
4> Downloading src/resources/audio_processing/agc2/rnn_vad/pitch_buf_24k.dat...
1> Downloading src/resources/audio_processing/transient/suppressed8kHz.pcm...
3> Downloading src/resources/audio_processing/transient/double-utils.dat...
1> Downloading src/resources/audio_processing/transient/audio32kHz.pcm...
3> Downloading src/resources/audio_processing/transient/detect32kHz.dat...
3> Downloading src/resources/audio_processing/transient/wpd0.dat...
2> Downloading src/resources/audio_processing/transient/wpd1.dat...
3> Downloading src/resources/audio_processing/transient/detect48kHz.dat...
2> Downloading src/resources/audio_processing/transient/detect16kHz.dat...
1> Downloading src/resources/audio_processing/transient/ajm-macbook-1-spke16m.pcm...
3> Downloading src/resources/audio_processing/transient/wpd7.dat...
2> Downloading src/resources/audio_processing/transient/wpd6.dat...
3> Downloading src/resources/audio_processing/transient/audio48kHz.pcm...
1> Downloading src/resources/audio_processing/transient/audio16kHz.pcm...
9> Downloading src/resources/audio_processing/transient/audio8kHz.pcm...
2> Downloading src/resources/audio_processing/transient/wpd3.dat...
4> Downloading src/resources/audio_processing/transient/wpd2.dat...
2> Downloading src/resources/audio_processing/transient/suppressed32kHz.pcm...
9> Downloading src/resources/audio_processing/transient/detect8kHz.dat...
4> Downloading src/resources/audio_processing/transient/suppressed16kHz.pcm...
1> Downloading src/resources/audio_processing/transient/float-utils.dat...
9> Downloading src/resources/audio_processing/transient/wpd4.dat...
9> Downloading src/resources/audio_processing/transient/wpd5.dat...
1> Downloading src/resources/audio_processing/agc/agc_voicing_prob.dat...
3> Downloading src/resources/audio_processing/agc/agc_with_circular_buffer.dat...
4> Downloading src/resources/audio_processing/agc/agc_spectral_peak.dat...
9> Downloading src/resources/audio_processing/agc/agc_no_circular_buffer.dat...
1> Downloading src/resources/audio_processing/agc/agc_audio.pcm...
2> Downloading src/resources/audio_processing/agc/agc_pitch_lag.dat...
4> Downloading src/resources/audio_processing/agc/agc_pitch_gain.dat...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyDelay_0_AST.bin...
2> Downloading src/resources/audio_processing/agc/agc_vad.dat...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_UnlimitedSpeed_0_AST.bin...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyDelay_0_TOF.bin...
2> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_UnlimitedSpeed_0_TOF.bin...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_Multi1_1_TOF.bin...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingLoss1_0_TOF.bin...
2> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingLoss1_0_AST.bin...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_Multi1_1_AST.bin...
1> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyChoke_1_TOF.bin...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke1_0_TOF.bin...
3> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke1_1_AST.bin...
2> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyChoke_0_AST.bin...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke1_1_TOF.bin...
1> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyChoke_0_TOF.bin...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyChoke_1_AST.bin...
3> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke1_0_AST.bin...
2> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke2_0_TOF.bin...
7> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyLoss_0_TOF.bin...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke2_1_AST.bin...
1> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingDelay1_0_TOF.bin...
9> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke2_1_TOF.bin...
3> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingChoke2_0_AST.bin...
2> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_IncreasingDelay1_0_AST.bin...
4> Downloading src/resources/remote_bitrate_estimator/VideoSendersTest_BweTest_SteadyLoss_0_AST.bin...
1> Downloading src/resources/network_tester/server_config.dat...
7> Downloading src/resources/network_tester/client_config.dat...
9> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR4_2.bin...
3> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR0.bin...
8> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR1.bin...
2> Downloading src/resources/rtp_rtcp/H263_CIF_IFRAME.bin...
4> Downloading src/resources/rtp_rtcp/H263Foreman_CIF_Pframe.bin...
7> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR5.bin...
1> Downloading src/resources/rtp_rtcp/H263_QCIF_IFRAME.bin...
9> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR4.bin...
8> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR4_1.bin...
3> Downloading src/resources/rtp_rtcp/H263Foreman_CIF_Iframe.bin...
2> Downloading src/resources/rtp_rtcp/H263_CIF_PFRAME.bin...
4> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR2.bin...
7> Downloading src/resources/rtp_rtcp/RTCPPacketTMMBR3.bin...
1> Downloading src/resources/voice_engine/audio_dtx16.wav...
9> Downloading src/resources/voice_engine/audio_long16big_endian.pcm...
8> Downloading src/resources/voice_engine/audio_short16.pcm...
3> Downloading src/resources/voice_engine/audio_tiny32.wav...
2> Downloading src/resources/voice_engine/audio_long8.pcm...
4> Downloading src/resources/voice_engine/audio_tiny44.wav...
7> Downloading src/resources/voice_engine/audio_tiny11.wav...
7> Downloading src/resources/voice_engine/audio_long16.wav...
3> Downloading src/resources/voice_engine/audio_long16.pcm...
1> Downloading src/resources/voice_engine/audio_long16noise.pcm...
8> Downloading src/resources/voice_engine/audio_tiny16.wav...
8> Downloading src/resources/voice_engine/audio_tiny48.wav...
4> Downloading src/resources/voice_engine/audio_tiny22.wav...
4> Downloading src/resources/voice_engine/audio_tiny8.wav...
8> Downloading src/resources/voice_engine/audio_long8mulaw.wav...
2> Downloading src/resources/utility/encapsulated_pcm16b_8khz.wav...
4> Downloading src/resources/utility/encapsulated_pcmu_8khz.wav...
8> Downloading src/resources/media/faces_I420.jpg...
2> Downloading src/resources/media/h264-svc-99-640x360.rtpdump...
4> Downloading src/resources/media/faces.1280x720_P420.yuv...
9> Downloading src/resources/media/video.rtpdump...
1> Downloading src/resources/media/captured-320x240-2s-48.frames...
8> Downloading src/resources/media/1.frame_plus_1.byte...
7> Downloading src/resources/media/faces_I400.jpg...
3> Downloading src/resources/media/faces_I422.jpg...
9> Downloading src/resources/media/voice.rtpdump...
2> Downloading src/resources/media/faces_I444.jpg...
8> Downloading src/resources/media/faces_I411.jpg...
Downloading 263 files took 2031.337688 second(s)
Hook 'download_from_google_storage --directory --recursive --num_threads=10 --no_auth --quiet --bucket chromium-webrtc-resources src/resources' took 2033.11 secs
Running hooks: 100% (22/22), done.

我这里下载的很顺畅,整个过程中木有出现什么异常点。但网上有说下面这种情况,这里也记录一下吧:

**出现了错误 “Error: Command ‘/usr/bin/python src/tools/clang/scripts/update.py’”,暂时不用管,继续后续的步骤。**

执行结果中的 `src/tools/clang/scripts/update.py`, [https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-359912-2.tgz](https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-359912-2.tgz) 后面的步骤会用到。

3. 编译

在执行编译前,我们需要配置好编译的参数和环境,生产出构建文件。这里就需要用到 GN 这个工具了。GN 是一个为 Ninja 生成构建文件的元构建系统。Ninja 是一个小型构建系统,特点是构建速度快。

3.1 使用 GN 来生产 Ninja 工程文件,在终端执行命令

hjsddeMacBook-Pro:webrtc starmier$ gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_debug=true'
ERROR Can't find source root.
I could not find a ".gn" file in the current directory or any parent,
and the --root command-line argument was not specified.

此时报错,不要惊慌,看看提示,找不到对应文件,因为我们没有跳转到下载源码时自动生成的文件夹src。
跳转后,再次执行此命令就可以了。

hjsddeMacBook-Pro:webrtc starmier$ cd src
hjsddeMacBook-Pro:src starmier$ ls
AUTHORS         call            pylintrc
BUILD.gn        codereview.settings resources
CODE_OF_CONDUCT.md  common_audio        rtc_base
DEPS            common_types.h      rtc_tools
ENG_REVIEW_OWNERS   common_video        sdk
LICENSE         data            stats
OWNERS          docs            style-guide
PATENTS         examples        style-guide.md
PRESUBMIT.py        ios         system_wrappers
README.chromium     license_template.txt    test
README.md       logging         testing
WATCHLISTS      media           third_party
abseil-in-webrtc.md modules         tools
api         native-api.md       tools_webrtc
audio           out         video
base            p2p         webrtc.gni
build           pc          whitespace.txt
build_overrides     presubmit_test.py
buildtools      presubmit_test_mocks.py
hjsddeMacBook-Pro:src starmier$ gn gen out/ios --args='target_os="ios" target_cpu="arm64" is_debug=true'
Warning: Multiple codesigning identities match "iPhone Developer"
Warning: - 17533420CE1F65FDB21F9F8436BD6B5962F9BC72 (selected)
Warning: - CDB55FFB48B60EB4E9A2E16C741BBDF8BDDCB29E
Warning: Please use either ios_code_signing_identity or 
Warning: ios_code_signing_identity_description variable to 
Warning: control which identity is selected.

Done. Made 1362 targets from 195 files in 7899ms

产生的工程文件在目录 /src/out/ios 下。通过命令查看下改目录下有哪些文件,在终端执行命令

hjsddeMacBook-Pro:src starmier$ ls out/ios
args.gn
build.ninja
build.ninja.d
clang_x64
low_bandwidth_audio_perf_test.runtime_deps
obj
toolchain.ninja
hjsddeMacBook-Pro:src starmier$

3.2 编译 APP 工程,在终端执行命令

hjsddeMacBook-Pro:src starmier$ ninja -C out/ios AppRTCMobile
ninja: Entering directory `out/ios'
[2774/2775] CODE SIGNING //examples:Ap...//build/toolchain/mac:ios_clang_arm64)
FAILED: AppRTCMobile.app/AppRTCMobile AppRTCMobile.app/_CodeSignature/CodeResources AppRTCMobile.app/embedded.mobileprovision AppRTCMobile.app/Info.plist 
python ../../build/config/ios/codesign.py code-sign-bundle -t=iphoneos -i=17533420CE1F65FDB21F9F8436BD6B5962F9BC72 -b=obj/examples/AppRTCMobile -e=../../build/config/ios/entitlements.plist AppRTCMobile.app -P=../../build/config/mac/plist_util.py -p=gen/examples/AppRTCMobile_generate_info_plist.plist -p=gen/examples/AppRTCMobile_partial_info.plist
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/f0b09b20-9e0f-400d-8d56-f89029620dda.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/50a2c8e7-5812-4695-ac90-ad1a4b5f72cb.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/3a913d08-6538-43c6-a1b3-0ee72d433ff5.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/182da8c1-a9e5-444e-b7c2-a6eaa82f9377.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/e9a87d16-3c5e-44b1-b196-74cbd677bb42.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/fcc37234-6f39-4142-988f-936c5ccb1553.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/f971d35b-70ef-43d8-b82c-f63d68f2678a.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/42797ccd-9e74-4568-b09f-1e6d5bd87bd9.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/05a615d5-cc11-4e11-be31-476d421a3835.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/babb92cb-5cf9-4d5f-825f-73dc3f29bcde.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/512a7bed-746c-4d61-a9cd-32920cce351f.mobileprovision.
Error: no mobile provisioning profile found for "com.google.AppRTCMobile".
ninja: build stopped: subcommand failed.

至此,编译 APP 的过程结束了, 编译过程的其它环节正确无误。虽然出现了 “Error: no mobile provisioning profile found for “com.google.AppRTCMobile”.” 的报错,这个 Error 信息表示 APP 的包名 “com.google.AppRTCMobile” 没有与之对应的苹果开发者证书的配置文件,将该 APP 安装到手机上后,会因证书配置文件的问题无法使用。这个问题很好解决,就是改 APP 的包名,在编译的时候选择对应的苹果开发者证书的配置文件后,重新编译就行了。解决方法:

默认的bundle identity是不能产生供应配置文件的(providing file);

例如找到定义了默认的bundle identity地方;

webrtc/sdk/objc/Framework/Info.plist:10: <string>org.webrtc.WebRTC</string>

webrtc/examples/objc/AppRTCMobile/ios/Info.plist:24: <string>com.google.AppRTCMobile</string>

用自己的bundle identity替换掉就可以了。

怎么找到自己的bundle identity呢?Xcode->preference->AppleID里找到有效的 providing file。

hjsddeMacBook-Pro:src starmier$ ninja -C out/ios AppRTCMobile
ninja: Entering directory `out/ios'
[26/27] CODE SIGNING //examples:AppRTC...//build/toolchain/mac:ios_clang_arm64)
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/f0b09b20-9e0f-400d-8d56-f89029620dda.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/50a2c8e7-5812-4695-ac90-ad1a4b5f72cb.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/3a913d08-6538-43c6-a1b3-0ee72d433ff5.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/182da8c1-a9e5-444e-b7c2-a6eaa82f9377.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/e9a87d16-3c5e-44b1-b196-74cbd677bb42.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/fcc37234-6f39-4142-988f-936c5ccb1553.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/f971d35b-70ef-43d8-b82c-f63d68f2678a.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/42797ccd-9e74-4568-b09f-1e6d5bd87bd9.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/05a615d5-cc11-4e11-be31-476d421a3835.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/babb92cb-5cf9-4d5f-825f-73dc3f29bcde.mobileprovision.
Warning: ignoring expired provisioning profile: /Users/hjsd/Library/MobileDevice/Provisioning Profiles/512a7bed-746c-4d61-a9cd-32920cce351f.mobileprovision.
[27/27] STAMP obj/examples/AppRTCMobile.stamp

进入目录 /src/out/ios 可以看下编译后产生了哪些文件。在终端执行命令

hjsddeMacBook-Pro:src starmier$ ls out/ios
AppRTCMobile.app
WebRTC.framework
args.gn
build.ninja
build.ninja.d
clang_x64
gen
low_bandwidth_audio_perf_test.runtime_deps
obj
pyproto
toolchain.ninja

在这一步,其实可以得到我想要的 WebRTC 库文件了,即 WebRTC.framework。但这不是正常获取库文件的路子。编译 WebRTC 库文件的方法有2种,分别为 ninja 命令行,python 脚本。

hjsddeMacBook-Pro:src starmier$ ninja -C out/ios framework_objc
ninja: Entering directory `out/ios'
ninja: no work to do.

可以看到 “ninja: no work to do.”,为什么会提示这条信息呢?原因在于上一步骤中已经编译产生了 WebRTC.framework 库文件。如果想看看只编译库文件的过程,那可以不执行上一步骤中编译 APP 的环节,即不执行命令 ninja -C out/ios AppRTCMobile,现在的情况是我们已经执行了该条命令,那直接删掉已经存在的 WebRTC.framework 库文件就行了。在终端执行命令

hjsddeMacBook-Pro:src starmier$ rm -rf out/ios/WebRTC.framework
hjsddeMacBook-Pro:src starmier$ ninja -C out/ios framework_objc
ninja: Entering directory `out/ios'
[97/97] STAMP obj/sdk/framework_objc.stamp

查看支持的类型:
hjsddeMacBook-Pro:src starmier$ lipo -info /MYPROJECT/webrtc/src/out/ios/WebRTC.framework/WebRTC
Architectures in the fat file: /MYPROJECT/webrtc/src/out/ios/WebRTC.framework/WebRTC are: arm64

方法二:

hjsddeMacBook-Pro:src starmier$ python tools_webrtc/ios/build_ios_libs.py --bitcode
INFO:root:Building WebRTC with args: target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false target_cpu="arm64" ios_deployment_target="10.0" rtc_libvpx_build_vp9=false enable_ios_bitcode=true use_goma=false enable_stripping=true
Done. Made 1360 targets from 195 files in 1580ms
INFO:root:Building target: framework_objc
ninja: Entering directory `/MYPROJECT/webrtc/src/out_ios_libs/arm64_libs'
ninja: no work to do.
INFO:root:Building WebRTC with args: target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false target_cpu="arm" ios_deployment_target="10.0" rtc_libvpx_build_vp9=false enable_ios_bitcode=true use_goma=false enable_stripping=true
Done. Made 1361 targets from 195 files in 1775ms
INFO:root:Building target: framework_objc
ninja: Entering directory `/MYPROJECT/webrtc/src/out_ios_libs/arm_libs'
ninja: no work to do.
INFO:root:Building WebRTC with args: target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false target_cpu="x64" ios_deployment_target="10.0" rtc_libvpx_build_vp9=false enable_ios_bitcode=true use_goma=false enable_stripping=true
Done. Made 1386 targets from 198 files in 1739ms
INFO:root:Building target: framework_objc
ninja: Entering directory `/MYPROJECT/webrtc/src/out_ios_libs/x64_libs'
ninja: no work to do.
INFO:root:Building WebRTC with args: target_os="ios" ios_enable_code_signing=false use_xcode_clang=true is_component_build=false is_debug=false target_cpu="x86" ios_deployment_target="10.0" rtc_libvpx_build_vp9=false enable_ios_bitcode=true use_goma=false enable_stripping=true
Done. Made 1386 targets from 198 files in 1467ms
INFO:root:Building target: framework_objc
ninja: Entering directory `/MYPROJECT/webrtc/src/out_ios_libs/x86_libs'
ninja: no work to do.
INFO:root:Merging framework slices.
INFO:root:Done.

生成的库文件在 out_ios_lib 目录下。脚本 tools_webrtc/ios/build_ios_libs.py 默认编译的架构是 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86'],编译出来的库为动态库。查看库支持的架构,以及是静态库还是动态库,在终端执行命令

hjsddeMacBook-Pro:src starmier$ lipo -info out_ios_libs/WebRTC.framework/WebRTC
Architectures in the fat file: out_ios_libs/WebRTC.framework/WebRTC are: x86_64 i386 armv7 arm64

提示:使用了动态库的 APP 在上架 APP Store 时,会报错不支持模拟器架构 ['x64', 'x86'],所以,需要剔除动态库中的模拟器架构,只使用真机架构 [‘arm64’, ‘arm’]。

可以修改脚本 tools_webrtc/ios/build_ios_libs.py 中的参数,将编译的架构改成 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64']。为什么去掉了 arm?因为现在人们使用的苹果设备几乎都是 arm64 架构了,arm 架构的苹果设备几乎绝迹,去掉 arm,也可以减轻 WebRTC 库的体积。

最后就是打开xcode工程了

open -a Xcode.app out/ios/all.xcworkspace
image.png

具体命令也可以直接参考源码里面下面目录中的命令,


image.png

特别感谢Minmin.sun的文章作为参考。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,088评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,715评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,361评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,099评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 60,987评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,063评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,486评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,175评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,440评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,518评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,305评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,190评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,550评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,880评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,152评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,451评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,637评论 2 335

推荐阅读更多精彩内容