Webrtc windows 编译

来源:互联网 发布:php开发微信公众平台 编辑:程序博客网 时间:2024/06/05 04:47

1:《 

WebRTC第一步

 》

http://blog.csdn.NET/cabbage2008/article/details/52791119


2:《WebRtc最新编译,最新版本2017》

(注释:下代码主要还是要翻墙,这里公司刚好用这个工具代理,Windows需要按照.NET库)

系统环境:win10

vs版本:vs2015


一:在客户端使用ShadowSocks作为代理!

我直接购买的ShadowSocks的服务器版本!10元人民币一个月左右。可以慢慢下!足够用了!


如果实在不想买,也可以自己搭建服务器,比较麻烦,容易出错。网上有教程!

二:depot_tools配置

下载地址:https://github.com/ipop-project/ipop-project.github.io/wiki/Building-the-WebRTC-lib-for-Windows

下载完后,自动更新。用管理员权限打开cmd,运行gclient,会自动进行更新,下载Git,svn等。


如果出现连接不上服务器的错误。可以设置一下Git的本地代理!


解决方法:

set http_proxy=127.0.0.1:1080
set https_proxy=127.0.0.1:1080


没问题后,执行gclient不报错即可!


不要忘了将depot_tools的路径配置到系统环境变量里面;

计算机属性->高级系统设置->高级->环境变量->系统变量->打开Path,最前边增加 E:\depot_tools; 


三:环境准备

下面几项必须准备 

1.系统locale最好设置成English,就是控制面板里面的Region 
控制面板-> 时钟、语言和区域->更改位置->管理->更改系统区域设置 
选择英语美国 重启 




2.安装vs2015 update2以上版本,其他的版本不受支持。

3.操作系统必须是x64架构,x86架构不支持。

4.安装vs2015的时候同时要安装win10sdk(10.0.10586)。


查看C:\Program Files (x86)\Windows Kits\10 里面数据是否拥有 


四:下载webrtc代码:

1.设置 depot_tools代理 [推荐] 此步骤必须在depot_tools下载并glcient之后做 
为了解决 depot_tools自身更新问题,为depot_tools增加代理支持,修改E:\depot_tools\bootstarp\win\get_file.js文件: 
(1)改xml_http = new ActiveXObject(“MSXML2.ServerXMLHTTP”); 第10行 
为 xml_http = new ActiveXObject(“MSXML2.ServerXMLHTTP.5.0”); 
(2)xml_http.open(“GET”, url, false); 第17行 前增加 
xml_http.setProxy(2, “127.0.0.1:1080”); 



(3)在E:\depot_tools下新建http_proxy.boto,内容如下: 

[Boto] 
proxy= 127.0.0.1 
proxy_port= 1080 


2.webrtc代码下载 
创建D:\webrtc,管理员权限打开cmd 
cd D:\webrtc 
设置下载工具代理环境变量: 
set http_proxy=http://127.0.0.1:1080 
set https_proxy=http://127.0.0.1:1080 
设置下载工具git代理: 
git config –global http.proxy http://127.0.0.1:1080 
设置BOTO代理,解决download google storage失败问题: 
set NO_AUTH_BOTO_CONFIG=E:\depot_tools\http_proxy.boto 
设置不再次下载工具链: 
set DEPOT_TOOLS_WIN_TOOLCHAIN=0 
设置生成工程环境变量: 
set GYP_GENERATORS=msvs-ninja,ninja 
set GYP_MSVS_VERSION=2015 
首次下载输入下载命令: 
fetch webrtc 
官网上有–nohooks 命令,下载依赖项不生成编译文件 本例建议去掉这个命令 
会像下图所示: 



如果中途断网:gclient sync 
查看到底是否正在下载: 
资源管理器->性能->资源监视器 




会发现shadowsocks进程正在下载


五:编译:


windows 
1.生成VS项目文件 
set DEPOT_TOOLS_WIN_TOOLCHAIN=0 
set GYP_GENERATORS=msvs-ninja,ninja 
set GYP_MSVS_VERSION=2015 (这里是2013会出现问题,生成的文件缺失很多)

生成VS2013项目文件(推荐使用) 
gn gen out/Default –ide=vs2013 
生成VS2015项目文件 
gn gen out/Default –ide=vs2015 

2.编译调试 
以VS2013为例,用VS2013打开all.sln 
将webrtc项目下example下的peerconnection_client设为启动项 







《最新webrtc编译 2017》

(注释:这个人写的也不错,可以参考,如果可以进群要到代码,那就更好了)


webRTC被越来越广泛的使用,但是很多人都对其源码的下载及编译感到非常的头疼,总结下我们团队在下载编译过程中遇到的问题。
最新的webRTC需要安装VS2015,最好安装旗舰版,社区版的话在编译过程中会提示遇到缺少一些东西,又需要安装各种东西,很麻烦,另外还需要安装个git。
由于代码在googlesource上所以首先需要找个好点的梯子去下载,几个G的代码最好找个速度快点的VPN。
下载官方的工具depot_tools,这个工具会帮你安装一些必要的下载及编译工具。
下载好了后解压,右键全部解压(不要直接在压缩包里面运行脚本),解压到比如J:\depot-tools,将D:\depot-tools添加到windows环境变量里。
建立J:\webrtcsource目录,进入打开cmd命令行,运行以下命令

fetch --nohooks webrtc
gclient sync

Git checkout master

代码下载完成后在master分支上,进入J:\webrtcsource\src目录,运行以下命令切换到一个release分支上并打上标签

gclient sync --with_branch_heads
git fetch origin
git checkout -b my_branch refs/remotes/branch-heads/58
查看如下图

如果编译过程中遇到如下错误

找不到gn.exe(Linux上找不到gn)
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_VERSION=2015

gclient runhooks


IOError: [Errno 2] No such file or directory: 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe'
请自己搜索安装windows standed SDK
下载后的目录结构如下

下载完成后进行编译啦,使用Ninja进行编译,首先需要生成Ninja工程:
进入到J:\webrtcsource\src目录下运行以下命令
gn gen out/Default
gn gen out/Default (编release版本)或者gn gen out/Default --args='is_debug=false' (编debug版本)
Ninja工程生成好后
ninja -C out/Default
编译完成后就可以在out/Default下看到生成的文件啦
用以下命令生成vs工程,直接用vs2015打开,方便看源码
gn --ide="vs2015" ----no-deps

对DLNA/Airplay/Miracast/Widi感兴趣的同学可进QQ群 582349005交流。
也可访问https://github.com/wirelessdisplay

需要webrtc源码的也可以进群索要^_^




《编译最新版webrtc源码和编译好的整个项目10多个G【分享】》

(注释:此文章作者上传源码到GitHub了,太好了!!其他文章可以不用看了)

https://github.com/JumpingYang001/webrtc





《Google官方编译chrome的方法,具体和编译webrtc差不多》

https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md

Checking out and Building Chromium for Windows

There are instructions for other platforms linked from the get the code page.

Instructions for Google Employees

Are you a Google employee? See go/building-chrome-win instead.

Contents

  • Instructions for Google Employees
  • System requirements
  • Setting up Windows
    • Visual Studio
  • Install
  • Get the code
  • Setting up the build
    • Using the Visual Studio IDE
    • Faster builds
  • Build Chromium
  • Run Chromium
  • Running test targets
  • Update your checkout

System requirements

  • A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly recommended.
  • At least 100GB of free disk space on an NTFS-formatted hard drive. FAT32 will not work, as some of the Git packfiles are larger than 4GB.
  • Visual Studio 2015 Update 3, see below (no other version is supported).
  • Windows 7 or newer.

Setting up Windows

Visual Studio

As of December 8, 2016 Chromium requires Visual Studio 2015, with the 14393 Windows SDK to build.

Install Visual Studio 2015 Update 3 or later - Community Edition should work if its license is appropriate for you. Use the Custom Install option and select:

  • Visual C++, which will select three sub-categories including MFC
  • Universal Windows Apps Development Tools > Tools (1.4.1) and Windows 10 SDK (10.0.14393)

You must have the 14393 Windows SDK installed - the 15063 SDK has errors and cannot be used to compile Chrome. It is okay to have multiple SDK versions installed as long as 14393 is one of them. The installer can be found in the Windows SDK archive.

When installing the 14393 Windows SDK choose Debugging Tools For Windows in order to get windbg and cdb. The latter is required for the build to succeed as some tests use it for symbolizing crash dumps.

Install depot_tools

Download the depot_tools bundle and extract it somewhere.

Warning: DO NOT use drag-n-drop or copy-n-paste extract from Explorer, this will not extract the hidden “.git” folder which is necessary for depot_tools to autoupdate itself. You can use “Extract all…” from the context menu though.

Add depot_tools to the start of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\src\depot_tools, open:

Control Panel → System and Security → System → Advanced system settings

If you have Administrator access, Modify the PATH system variable and put C:\src\depot_tools at the front (or at least in front of any directory that might already have a copy of python or Git).

If you don't have Administrator access, you can add a user-level PATH environment variable and put C:\src\depot_tools at the front, but if your system PATH has a Python in it, you will be out of luck.

Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to use a google-internal version).

From a cmd.exe shell, run the command gclient (without arguments). On first run, gclient will install all the Windows-specific bits needed to work with the code, including msysgit and python.

  • If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it may appear to run properly, but msysgit, python, and other tools may not get installed correctly.
  • If you see strange errors with the file system on the first run of gclient, you may want to disable Windows Indexing.

After running gclient open a command prompt and type where python and confirm that the depot_tools python.bat comes ahead of any copies of python.exe. Failing to ensure this can lead to overbuilding when using gn - see crbug.com/611087.

Get the code

Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):

$ mkdir chromium && cd chromium

Run the fetch tool from depot_tools to check out the code and its dependencies.

$ fetch chromium

If you don't want the full repo history, you can save a lot of time by adding the --no-history flag to fetch.

Expect the command to take 30 minutes on even a fast connection, and many hours on slower ones.

When fetch completes, it will have created a hidden .gclient file and a directory called src in the working directory. The remaining instructions assume you have switched to the src directory:

$ cd src

Optional: You can also install API keys if you want your build to talk to some Google services, but this is not necessary for most development and testing purposes.

Setting up the build

Chromium uses Ninja as its main build tool along with a tool called GN to generate .ninja files. You can create any number of build directorieswith different configurations. To create a build directory:

$ gn gen out/Default
  • You only have to run this once for each new build directory, Ninja will update the build files as needed.
  • You can replace Default with another name, but it should be a subdirectory of out.
  • For other build arguments, including release settings, see GN build configuration. The default will be a debug component build matching the current host operating system and CPU.
  • For more info on GN, run gn help on the command line or read the quick start guide.

Using the Visual Studio IDE

If you want to use the Visual Studio IDE, use the --ide command line argument to gn gen when you generate your output directory (as described on the get the code page):

$ gn gen --ide=vs out\Default$ devenv out\Default\all.sln

GN will produce a file all.sln in your build directory. It will internally use Ninja to compile while still allowing most IDE functions to work (there is no native Visual Studio compilation mode). If you manually run “gen” again you will need to resupply this argument, but normally GN will keep the build and IDE files up to date automatically when you build.

The generated solution will contain several thousand projects and will be very slow to load. Use the --filters argument to restrict generating project files for only the code you're interested in, although this will also limit what files appear in the project explorer. A minimal solution that will let you compile and run Chrome in the IDE but will not show any source files is:

$ gn gen --ide=vs --filters=//chrome out\Default

There are other options for controlling how the solution is generated, run gn help gen for the current documentation.

Faster builds

  • Reduce file system overhead by excluding build directories from antivirus and indexing software.
  • Store the build tree on a fast disk (preferably SSD).

Still, expect build times of 30 minutes to 2 hours when everything has to be recompiled.

Build Chromium

Build Chromium (the “chrome” target) with Ninja using the command:

$ ninja -C out\Default chrome

You can get a list of all of the other build targets from GN by running gn ls out/Default from the command line. To compile one, pass to Ninja the GN label with no preceding “//” (so for //chrome/test:unit_tests use ninja -C out/Default chrome/test:unit_tests`).

Run Chromium

Once it is built, you can simply run the browser:

$ out\Default\chrome.exe

(The “.exe” suffix in the command is actually optional).

Running test targets

You can run the tests in the same way. You can also limit which tests are run using the --gtest_filter arg, e.g.:

$ out\Default\unit_tests.exe --gtest_filter="PushClientTest.*"

You can find out more about GoogleTest at its GitHub page.

Update your checkout

To update an existing checkout, you can run

$ git rebase-update$ gclient sync

The first command updates the primary Chromium source repository and rebases any of your local branches on top of tip-of-tree (aka the Git branch origin/master). If you don't want to use this script, you can also just use git pull or other common Git commands to update the repo.

The second command syncs the subrepositories to the appropriate versions and re-runs the hooks as needed.



写在最后,注意几个问题:

1:自己下代码,用VPN,参考前面的文章严格执行,应该没有问题;

2:可以参考Google编译chrome的方法应用命令行,目前最新的默认就是vs2015(Update 3 );

3:用vs启动all.sln的时候,也用命令行;我直接双击为什么加载不了工程??

4:别忘了src同级目录中的“.gclient“,“.gclient_entries”文件; “.gclient”文件中有保护一些配置信息,包括目标系统代码;

5:如果没有上面两个文件,那么gclient工具总是提示没有config;

原创粉丝点击