Compilation of the Windows version of Webrtc (based on the sound network image)

Compilation of the Windows version of Webrtc (based on the sound network image)

 

Preliminary preparation:

1. Operating System

Windows 10 Preview Build 17063 or later versions require curl and tar commands, as well as PowerShell functions

How to verify whether curl and tar are supported, open PowerShell

This must be supported, because in the download process of webrtc, these instructions are needed to support!

 

2. git installation

git - https://git-scm.com/download/win

 

3. Installation of vs2017

visualstudio2017community - https://download.visualstudio.microsoft.com/download/pr/aaebc214-bc67-4137-9bea-04fcb0c90720/2e18f27594472d0c7515d9cbe237bd56/vs_community.exe

3.1 Modify "Windows Software Development Kit"> +Debugging Tools for Windows This is a must

 There should be multiple versions of this Windows Phone Kits, all of which are checked on Debugging Tools For Windows

3.2 SDK version selection

These must be selected well, otherwise the LIB and INCLUDE dependent on the compilation process will be incomplete, causing compilation failure, such as:

AssertionError  File "C:/Users/Administrator/webrtc/src/build/toolchain/win/setup_toolchain.py", line 278, in main

assert vc_lib_atlmfc_path

 

4. Python installation

python2 - https://www.python.org/downloads/release/python-2716/

4.1 pip installation

https://www.cnblogs.com/baiyuer/p/9606773.html

Configuration of environment variables

4.2 Installation of pywin32 module pip install pywin32

This module is not installed. During the compilation process, the error "No module named win32file" will appear

 

Environment configuration

1. The basic configuration of git, save the following content as the file git_env.bat file, waiting for backup

git config --global user.email "[email protected]"
git config --global user.name "freeabc"
 
git config --global url.http://120.92.49.206:3232/chromiumsrc/webrtc.git.insteadOf https://chromium.googlesource.com/external/webrtc.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/base.git.insteadOf https://chromium.googlesource.com/chromium/src/base
git config --global url.http://120.92.49.206:3232/chromiumsrc/build.git.insteadOf https://chromium.googlesource.com/chromium/src/build
git config --global url.http://120.92.49.206:3232/chromiumsrc/buildtools.git.insteadOf https://chromium.googlesource.com/chromium/src/buildtools
git config --global url.http://120.92.49.206:3232/chromiumsrc/gradle.git.insteadOf https://chromium.googlesource.com/external/github.com/gradle/gradle.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/ios.git.insteadOf https://chromium.googlesource.com/chromium/src/ios.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/testing.git.insteadOf https://chromium.googlesource.com/chromium/src/testing
git config --global url.http://120.92.49.206:3232/chromiumsrc/third_party.git.insteadOf https://chromium.googlesource.com/chromium/src/third_party
git config --global url.http://120.92.49.206:3232/chromiumsrc/clang-format.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/cfe/tools/clang-format.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libcxx.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/libcxx.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libcxxabi.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/libcxxabi.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libunwind.git.insteadOf https://chromium.googlesource.com/external/llvm.org/libunwind.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/android_ndk.git.insteadOf https://chromium.googlesource.com/android_ndk.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/android_tools.git.insteadOf https://chromium.googlesource.com/android_tools.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/auto.git.insteadOf https://chromium.googlesource.com/external/github.com/google/auto.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/catapult.git.insteadOf https://chromium.googlesource.com/catapult.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/compact_enc_det.git.insteadOf https://chromium.googlesource.com/external/github.com/google/compact_enc_det.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/colorama.git.insteadOf https://chromium.googlesource.com/external/colorama.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/depot_tools.git.insteadOf https://chromium.googlesource.com/chromium/tools/depot_tools.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/errorprone.git.insteadOf https://chromium.googlesource.com/chromium/third_party/errorprone.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/ffmpeg.git.insteadOf https://chromium.googlesource.com/chromium/third_party/ffmpeg.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/findbugs.git.insteadOf https://chromium.googlesource.com/chromium/deps/findbugs.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/freetype2.git.insteadOf https://chromium.googlesource.com/chromium/src/third_party/freetype2.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/harfbuzz.git.insteadOf https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/gtest-parallel.git.insteadOf https://chromium.googlesource.com/external/github.com/google/gtest-parallel
git config --global url.http://120.92.49.206:3232/chromiumsrc/googletest.git.insteadOf https://chromium.googlesource.com/external/github.com/google/googletest.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/icu.git.insteadOf https://chromium.googlesource.com/chromium/deps/icu.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/jsr-305.git.insteadOf https://chromium.googlesource.com/external/jsr-305.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/jsoncpp.git.insteadOf https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/junit.git.insteadOf https://chromium.googlesource.com/external/junit.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/fuzzer.git.insteadOf https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libjpeg_turbo.git.insteadOf https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libsrtp.git.insteadOf https://chromium.googlesource.com/chromium/deps/libsrtp.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libvpx.git.insteadOf https://chromium.googlesource.com/webm/libvpx.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/libyuv.git.insteadOf https://chromium.googlesource.com/libyuv/libyuv.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/linux-syscall-support.git.insteadOf https://chromium.googlesource.com/linux-syscall-support.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/mockito.git.insteadOf https://chromium.googlesource.com/external/mockito/mockito.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/nasm.git.insteadOf https://chromium.googlesource.com/chromium/deps/nasm.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/openh264.git.insteadOf https://chromium.googlesource.com/external/github.com/cisco/openh264
git config --global url.http://120.92.49.206:3232/chromiumsrc/requests.git.insteadOf https://chromium.googlesource.com/external/github.com/kennethreitz/requests.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/robolectric.git.insteadOf https://chromium.googlesource.com/external/robolectric.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/ub-uiautomator.git.insteadOf https://chromium.googlesource.com/chromium/third_party/ub-uiautomator.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/usrsctp.git.insteadOf https://chromium.googlesource.com/external/github.com/sctplab/usrsctp
git config --global url.http://120.92.49.206:3232/chromiumsrc/binaries.git.insteadOf https://chromium.googlesource.com/chromium/deps/yasm/binaries.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/patched-yasm.git.insteadOf https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/tools.git.insteadOf https://chromium.googlesource.com/chromium/src/tools
git config --global url.http://120.92.49.206:3232/chromiumsrc/client-py.git.insteadOf https://chromium.googlesource.com/infra/luci/client-py.git
git config --global url.http://120.92.49.206:3232/chromiumsrc/boringssl.git.insteadOf https://boringssl.googlesource.com/boringssl.git

2. To prepare the environment before compiling, save the following content as the file pre_build.bat for use

set GYP_DEFINES = target_arch=x64
set GYP_MSVS_VERSION=2017

set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;F:\Windows Kits\10\Lib\10.0.17763.0\um\x64;
set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;F:\Windows Kits\10\Include\10.0.17763.0\ucrt;F:\Windows Kits\10\Include\10.0.17763.0\um;F:\Windows Kits\10\Include\10.0.17763.0\winrt;

set DEPOT_TOOLS_UPDATE=0
set GYP_MSVS_VERSION=2017 
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
set GYP_DEFINES=target_arch=x64
set GYP_GENERATORS=msvs-ninja,ninja 

Be sure to change LIB, INCLUDE, GYP_MSVS_OVERRIDE_PATH, GYP_MSVS_VERSION to the actual path of your local installation. The above example is the absolute path on my machine! ! ! ! ! !

 

Compilation process

1. First execute the above script git_env.bat

2. Download depot_tools

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git -b gitlab

3. Configure the environment variables of depot_tools, see the screenshot in 4.1 above

4. Create directory webrtc

5. Open cmd.exe and enter the webrtc directory

6. gclient config --name src https://chromium.googlesource.com/external/webrtc.git@gitlab

7. Configure environment variables

7.1 set CDS_CLANG_BUCKET_OVERRIDE=http://120.92.49.206:3232/chromiumsrc/commondatastorage/raw/master/public/chromium-browser-clang

7.2 set DEPOT_TOOLS_WIN_TOOLCHAIN=0

8. Synchronize path

gclient sync --patch-ref=https://chromium.googlesource.com/chromium/src/build.git@gitlab

9. Execute the above script pre_build.bat

10. gn gen out/Default --ide=vs2017

11. ninja -C out/Default

If it goes well, it can basically be compiled and passed!

Guess you like

Origin blog.csdn.net/freeabc/article/details/109304937