Google WebRTC 编译笔记

安装软件:

Depot Tools

1. You'll need to have the depot tools installed:

https://sites.google.com/a/chromium.org/dev/developers/how-tos/depottools 

2. You need git installed (needed for getting WebMsource):

http://git-scm.com/

Linux (Ubuntu/Debian)

This, and more, is described on the Chromium site:

http://code.google.com/p/chromium/wiki/LinuxBuildInstructions

 

A script is provided for Ubuntu, which is availableafter your first gclient sync:

$ ./build/install-build-deps.sh

 

Pulse Audio is missing from the script. On Ubuntu,this is provided by the libpulse-dev package.

Although the install-build-deps.sh script is the recommended method, it will installmuch more than you need. Here is a (hopefully complete) minimal list ofpackages to install (sudo apt-get install...):

g++ (>= 4.2)

python (>= 2.4)

libasound2-dev

libpulse-dev

libjpeg62-dev

libxv-dev

libgtk2.0-dev

libexpat1-dev

 

For 32-bit builds on a 64-bit system:

lib32asound2-dev

ia32-libs

 

Tips for other distributions are available on theChromium page.

Windows

·      Visual Studio 2008 or newer, with all service packs installed.

o  Using the free version Visual C++ Express does not work out of the box,but we think it should be possible by installing WDK, seeChromium's instructions for this (Additional Software, step 6). If you make it work,please let us know at the mailing list discuss-webrtc, and we will update thisdocumentation.

·      Microsoft SDK 7.1 Older versions might work as well, as long as they support Vista specificfeatures (building on XP should be fine).

o  Ensure the library and include directories for the SDK are set inMSVC|Tools|Options|Projects and Solutions|VC++ Directories (e.g. C:\ProgramFiles\Microsoft SDKs\Windows\v7.1\Lib).

·      Microsoft DirectX SDK (June 2010) (others might work as well). Please check that this SDK getsinstalled like this:

o  Verify MSVC|Tools|Options|Projects and Solutions|VC++ Directories hasInclude: $(DXSDK_DIR)include and Lib: $(DXSDK_DIR)lib\x86.

o  Make sure the DirectX include directories appear first in the search path, otherwise you may get build errors.

·      Python

·      For Visual 2010 some extra steps areneeded:

o  Install VS2010 SP1.

o  In case VS2010 is not detectedautomatically by GYP or in case you have multiple versions of Visual Studio inyour build machine, then to generate the .sln/.vcxproj, you need to set anenvironment variable: GYP_MSVS_VERSION=2010

o  For test programs that use MFC, makesure that the solution links to the MFC libraries statically. This getsautomatically set in VS2005, but there is a bug in solution file generator forVS2010.

OS X

XCode 3.0 or higher

其中Windows环境下还需要注意打补丁

Build environment

Prerequisite software

·        Windows XP SP3 or later.

o   A 64 bit OS is highly recommended as building on 32 bit OS is constantly becoming harder, is alot slower and is not actively maintained.

·        Visual Studio Express, Standard, or Pro 2008 or 2010.

o   If you don't own a copy of Visual Studio, you can (freely) downloadVisual Studio 2008 Expressw/SP1

o   For non-Express versions:

§ Make sure that "X64 Compilers and Tools" are installed as partof Visual Studio -Important! If you don't install this now, you won't be able tocorrect your installation later without uninstalling due to a bug in VS2008SP1.

§ For VS 20088, if you're using the Standard Edition, make sure to alsoinstall C# development. Otherwise cl.exe won't be copied. SeeKB969866.

o   For Express versions, keep in mind that debugging is extremely limited.

Additional (free) downloads

1.   Visual Studio 2008

1.   Install VS2008 SP1 (unless you already have SP1, e.g. because youdownloaded VS2008 Express w/SP1 via the link above).

2.   Install KB967631, KB960075, and KB957912.

3.   Install the Windows 7.1 SDK

1.   Read the instructions on the SDK download page! Readit again!

2.   You might need to reboot. You can save space by notinstalling the documentation and code samples.

4.   Integrate the SDK with VisualStudio

1.   Start > All Programs > Microsoft Windows SDK> Visual Studio Registration > Windows SDK Configuration Tool.
If this program crashes, try running it from the command line with: windowssdkver -version:v7 -legacy

2.   If build still fails, try registering the SDK manually.

3.   If you had a previous version of the SDK installedbefore installing v7.0, verify that your VC++ directories are set to use v7.0and not an earlier SDK. Seeregistering the SDK manually for details.

5.   If you are not using Visual Studio 2008 Express,install KB971092. Yes, that's a 365 MB update. :/

6.   If you are using Visual Studio 2008 Team System andplan to use the profiler, installKB958842.

2.   Visual Studio 2010 / Visual C++ 2010 Express

1.   Install VS2010 SP1.

2.   Install the Windows 7.1 SDK.

3.   You may need this repair to restore the libraries if the SDK was already installed when you installedSP1.

4.   As of 2011-04-01, VS2010 is not detected automaticallyby GYP, so to generate the .sln/.vcxproj, you need to

1.   set/export GYP_MSVS_VERSION=2010(or create new Windows environment variable)

§ Note: 2010e for expressversions.

       gclient runhooks

    Note: As of 2011-07-12 you may see some warnings fromGYP about missing files from JavaScriptCore.gyp. You can ignore these.

    You may want to double-check that VisualStudio 2010 isusing the right SDK by renaming Include and Lib in C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A when trying to build. If your compile failsafter this (likely complaining of missing includes), see the Troubleshootingsection on manually installing the SDK.

 Install the DirectX SDK

o  Visual Studio 2008:

§ Open Tools > Options > Projects and Solutions > VC++ Directories.

§ Under "Include files" add $(DXSDK_DIR)include to the start of the list.

§ Under "Library files" add $(DXSDK_DIR)lib\x86 to the start of the list.

o  Visual Studio 2010:

0.   Go to View > Property Manager (can take a while toload).

1.   Expand any projects' property sheet (i.e. chrome) andexpand either Debug or Release.

2.   Right click on "Microsoft.Cpp.Win32.user" (thisis your user configuration) and go to "Properties"

3.   Under "VC++ Directories", "IncludeDirectories" insert $(DXSDK_DIR)\include; to the beginning of the include list

4.   Under "VC++Directories", "Library Directories" insert$(DXSDK_DIR)\lib\x86; to thebeginning of the library list.

o  Make sure the DirectX include and lib directories appear first in the search path, otherwise you may get build errors.

 If you use Visual Studio 2008 Express:

0.   Install the WDK for the ATL headers and libs.

0.   Verify MSVC|Tools|Options|Projects and Solutions|VC++Directories has Include: [WDK]include\atl71 and Lib: [WDK]lib\Atl\i386 where [WDK] is the WDK install directory.

1.   To build x64 targets (e.g. x64 Native Client) onVisual Studio 2008 Express:

0.   Download http://www.cppblog.com/Files/xcpp/VCE64BIT_WIN7SDK.zip, unzip, and follow the README instructions.

1.   For further information on that and x64 targetbuilding with Visual Studio 2008 Express (if you care), seehttp://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/ andhttp://www.cppblog.com/xcpp/archive/2009/09/09/vc2008express_64bit_win7sdk.html.

 If you're using Visual C++ 2010 Express:

o  Install the WDK for the ATL/MFC headers and libs (else you will get"Missing library atlthunk.lib" and "Missing headeraltbase.h" errors).

0.   After you've done this, create a system-wideenvironment variable named WDK_DIR viaRun...->SystemPropertiesAdvanced->Environment Variables...->New...(inSystem variables), with the name of WDK_DIR and the location youinstalled the WDK (e.g. C:\WinDDK\7600.16385.1).

1.   Restart Visual C++ 2010 Express or the command lineenvironment (if they're open, otherwise they won't have this environmentvariable set).

2.   Open chrome.sln, go to View->Property Manager fromtop menu, wait for this pane to load.

3.   Expand chrome->Debug and right click"Microsoft.Cpp.Win32.user" and click "Properties".

4.   Under "VC++ Directories" add

§ $(WDK_DIR)\inc\atl71;$(WDK_DIR)\inc\mfc42; to the include list and

§ $(WDK_DIR)\lib\ATL\i386; to the library list.

5.   If you want to build nacl, do the same for 64-bit.Expand chrome_nacl_win64->Debug | x64, right click"Microsoft.Cpp.x64.user" and click "Properties".

6.   Under "VC++ Directories" add

§ $(WDK_DIR)\inc\atl71;$(WDK_DIR)\inc\mfc42; to the include list and

§ $(WDK_DIR)\lib\ATL\amd64; to the library list.

 (Optional) Install cygwin.

安装depot_tools

Install the depot_tools

 
 

Chromium and Chromium OS use  a package of scripts called depot_tools to manage checkouts and code reviews.  If you want more details about depot_tools, you can check thedepot_tools information page. The depot_tools package  includes gclient, gcl, git-cl, repo, and others.

 

Steps for installing

 

Linux and Mac

 1.      Grab the checkout with one of: 

1.      non-committers (to depot_tools): svn co  http://src.chromium.org/svn/trunk/tools/depot_tools

 2.      committers (again, to depot_tools): svn co  svn://svn.chromium.org/chrome/trunk/tools/depot_tools 

2.      Add depot_tools to  your PATH:

 1.      $ export PATH="$PATH":`pwd`/depot_tools 

2.      You may want to add this to your .bash_aliases file or your shell's equivalent so that you don’t  need to reset your $PATH manually each time you open a new shell.

 Windows (Cygwin and non-Cygwin) 

If using Cygwin, you should  have already installed cygwin by this point.

 1.      Get a copy of depot_tools: 

o     Cygwin: Check out the tools using the command in step (1)  for Linux and Mac above.

 o     Non-cygwin: Download depot_tools.zip and decompress it. 

2.      Run gclient once from the cmd shell, which causes it to install  its own copy of svn and other tools. If you see strange errors with the file  system on the first run of gclient, you may want todisable Windows Indexing.

 3.      Add depot_tools to the  end (not start!) of your PATH: 

o     System Properties, Advanced properties, Environment Variables, modify  the "Path" system variable.

 4.      Cygwin only: Close your shells, reopen a Cygwin shell, and ensure  that which svn reports /usr/bin/svn. If not, you either didn't install the svn package  properly when installing Cygwin, or you put depot_tools on the front of your  PATH instead of the back. Fix this before checking out any code, as once you  check out, you want to always use the same svn (Cygwin or depot_tools) to  work with that checkout -- otherwise strange things can happen that are most  easily fixed by completely wiping the checkout. 

See also Howto: depot tools

 

环境准备好后按下面步骤编辑

运行gclient.bat,会自动安装git和svn

然后运行gclient.py confighttp://webrtc.googlecode.com/svn/trunk

Getting the code and building

Create a working directory, enter it, and run:

$ gclient confighttp://webrtc.googlecode.com/svn/trunk

$ gclient sync --force

以上应该是cgwin下运行,如果是windows命令行应该增加后缀如下所示

gclient.py config http://webrtc.googlecode.com/svn/trunk

gclient.py sync--force

必须如此运行,通过gyp会自动生成 vs的sln等工程文件。

If you're a committer, substitute https for http. On Windows,use gclient.bat instead (or prefix the commands by invoking python).

 On Linux, ensure your dependencies are up to date, asdescribed on theprerequisites page.

 The sync will generate native build files for yourenvironment usinggyp (Linux: make, OS X: XCode, Windows: Visual Studio).This generation can also be forced manually:

$ gclient runhooks --force

 On Windows, gyp will use the latest Visual Studio onyour system by default. In order to specify a particular Visual Studio version,there are a few options. You can set an environment variable GYP_MSVS_VERSION=<version> before runhooks, or manually run the gyp command triggered by runhooks.From the trunk/ directory:

$ build/gyp_chromium --depth=. -G msvs_version=<version> webrtc.gyp

where <version> is, for example, 2008.

 You should now be able to build the sample programspeerconnection_client (Windows only) and peerconnection_server (Windows, Linux,Mac).

Sample Application

The sample application creates a simple video chatclient and server, using thePeerConnection C++ API.

How to Build

On Linux:

$ cd trunk
$ makepeerconnection_server

On Windows:

Use Visual Studio to open and build the trunk/webrtc.sln solution file. Thiswill build both peerconnection_server.exe and peerconnection_client.exe.

On Mac:
$ cd trunk
$ openwebrtc.xcodeproj/

This will open XCode. Build the peerconnection_server target using XCode.

It is also possible to use regular Make to build. To do this, set theenvironment variable GYP_GENERATORS to make (in bash, typeGYP_GENERATORS=make) and then run gclient sync. With this, you can for instance import the project into Eclipse as amakefile project and use that instead of XCode.

本人出现了一些错误,vs2008找不到python(已经加到了path,可能是由于没有重启,比较懒,人工搞定),导致自定义编译无法执行,人工在目录trunk\third_party\yasm\source\patched-yasm\modules\arch\x86下运行
gen_x86_insn.py,然后将生成的如下文件:x86cpu.gperf、x86insn_gas.gperf、x86insn_nasm.gperf、x86regtmod.gperf、x86insns.c拷贝到trunk\build\Debug\obj\global_intermediate\third_party\yasm下,然后编译即可。

How toRun

The resulting binaries appear in xcodebuild/Debug/ on Mac, out/Debug/ on Linux and build/Debug/ on Windows. 

Once built, start the peerconnection_server application. This is a simple web server that's builtto exchange signaling messages between instances of peerconnection_client (Note: the client is Windows only). 

You can also use the test HTML page (trunk/peerconnection/samples/server/server_test.html) to connect to the server and enable loopback whenyou've only got one instance of peerconnection_client running. Enabling loopback causes the client to set up a video/voicesession with itself. 

When the server is running, you'll see a messageindicating that it is running: 

Server listening on port 8888

OnWindows

Next, start peerconnection_client.exe. This is a Windows application that uses thePeerConnection C++ API for setting up a video+voice session with a remote peer.The application uses the server to send signaling messages (messages generatedby the API) between the peers.

 The UI of the application consists of these threeparts:

1.   Connect to server. Here you specify the machine thatis currently running the server. Hit "Connect" or press return.

2.   Select peer. When you've connected with the server,you'll see a list of other peerconnection_client instances (or server_test.html) that are currently connected. To connect with apeer, double click or select+press return. This will start the local capturecomponents (mic+webcam) as well as exchange signaling messages with the peervia the server. You can verify this via the server console.

3.   Video chat. When the signalling messages have beenexchanged, the PeerConnection API creates channels for the voice and videostreams and you will see the remote video in full window and the local videocapture in the lower right corner.

To end a chat session and go back to selecting a peer,press Esc. To disconnect from the server and go back to the initial UI, pressEsc again.

On Mac, Linux

Open trunk/peerconnection/samples/server/server_test.html. Click connect. Observe that thepeerconnection_server announces your connection. Now you can open one more tabwith the page, connect that too (with a different name) and send messagesbetween the peers.

 如何测试

This test client is a simple  functional test for a WebRTC enabled browser. It

has only been tested with  Chrome, and is most likely only working with Chrome at

the moment. The following  instructions are in part Chrome specific

The following is necessary  to run the test:- A WebRTC enabled Chrome binary. (Available in dev or canary channel, 18.0.1008or newer.)- A peerconnection_server  binary (make peerconnection_server).It can be used in  two scenarios:1. Single client calling  itself with the server test page(peerconnection/samples/server/server_test.html)  in loopback mode as a fakeclient.2. Call between two clients.

To start the test for scenario (1):

1. Start  peerconnection_server.

2. Start the WebRTC Chrome  build:$  <path_to_chrome_binary>/chrome --enable-media-streamThe --enable-media-stream  flag is required for the time being.

3. Open the server test  page, ensure loopback is enabled, choose a name (forexample  "loopback") and connect to the server.

4. Open the test page,  connect to the server, select the loopback peer, clickcall.

To start the test for scenario (2):

1. Start  peerconnection_server.

2. Start the WebRTC Chrome  build, see scenario (1).

3. Open the test page,  connect to the server.

4. On another machine, start  the WebRTC Chrome build.5. Open the test page,  connect to the server, select the other peer, click call.

Note 1: There is currently a  limitation so that the camera device can only beaccessed once, even if in  the same browser instance. Hence the need to use twomachines for scenario (2).

Note 2: The web page must  normally be on a web server to be able to access thecamera for security reasons.See http://blog.chromium.org/2008/12/security-in-depth-local-web-pages.htmlfor more details on this  topic. This can be overridden with the flag--allow-file-access-from-files,  in which case running it over the file://URI scheme works.Note 3: It's possible to  specify the server and name in the url:.../webrtc.html?server=my_server&name=my_name

附录

Usingdepot_tools

 
 

目录

 1.      1 Introduction 

2.      2 Installing

 3.      3 Disable auto update 

1.      3.1 Caveat 

4.      4 Help! 

5.      5 gclient 

1.      5.1 .gclient file 

2.      5.2 .gclient example 

3.      5.3 DEPS file 

4.      5.4 Pinned deps 

5.      5.5 DEPS examples 

6.      6 Sending patches 

Introduction

Chromium uses a package of scripts, the depot_tools, to manage interaction with the  Chromium source code repository and the Chromium development process. It contains  the following utilities:

  • gclient:       Meta-checkout tool managing both subversion and git checkouts. It is       similar torepo tool except that it       works on Linux, OS X, and Windows and supports both svn and git. On the       other hand, gclient doesn't integrate any code review functionality.  
  • gcl: Rietveld       code review tool for subversion. The gcl tool runs presubmit       scripts.  
  • git-cl: Rietveld       code review tool for git. The git-cl tool runs presubmit scripts.  
  • hammer: (Obsolete)       Wrapper script for building Chromium with theSCons software construction       tool.  
  • svn [Windows       only]: subversion       client for Chromium development. (Executable Subversion binaries are       included in the depot_tools on Windows       systems as a convenience, so that working with Chromium source code does       not require a separate Subversion download.)  
  • drover: Quickly       revert svn commits.  
  • cpplint.py: Checks for       C++ style compliance.  
  • presubmit_support.py:       Runs PRESUBMIT.py presubmit checks.  
  • repo: The repo       tool.  
  • trychange.py:       Try server tool. It is wrapped by gcl try and git-try.  
  • git-try: Try change       tool for git users  
  • wtf: Displays the       active git branches in a chromium os checkout.  
  • weekly: Displays the       log of checkins for a particular developer since a particular date for       git checkouts.  
  • git-gs: Wrapper for       git grep with relevant source types.  
  • zsh-goodies:       Completion for zsh users.   

It is highly encouraged to look around and open the files in a  text editor as this page can quickly become outdated. Please keep this page  updated! 

Installing 

See Howto: install the depot tools

Disable auto update 

The gclient and git-cl scripts are actually wrapper scripts that will, by default,  always update thedepot_tools to the latest versions of the tools checked in athttp://src.chromium.org/svn/trunk/tools/depot_tools/.  To disable this auto-update behavior, either:  

  • Set the environment variable DEPOT_TOOLS_UPDATE=0.  
  • Remove depot_tools/.svn.       This may be appropriate if you choose to install depot_tools in a common       location for use by multiple users (for example,/usr/local/bin on       a Linux system).  

Note: If you aren't using either of these helper scripts (e.g.  you're developing Chromium OS), then you will need to manually update  depot_tools yourself from time to time with a simple: svn up

Caveat

Chromium engineers expect the auto-updating behavior of  depot_tools, checkout or presubmit breakage may ensue. 

Help!

These tools don't have man pages but have integrated help! Try  all of these commands! If the doc is not adequate, send patches to fix them.  

  • gclient help  
    •    It works for subcommands too like:        gclient help sync     
  • git-cl help     
    • It works for subcommands too like:        git-cl help patch     
  • git-try help  
  • gcl help     
    • It works for subcommands too like:        gcl try help   

Otherwise, there are many great  text editors that can  help you out to read what the tools are actually doing. 

gclient

 gclient is a python script to manage a workspace of modular  dependencies that are each checked out independently from different  subversion or git repositories. Features are:  
  • Dependencies can be specified on a       per-OS basis.  
  • Dependencies can be specified relative       to their parent dependency.  
  • Variables can be used to abstract       concepts.  
  • Hooks can be specified to be run after       a checkout.  
  • .gclient and DEPS are python scripts,       you can hack in easily or add additional configuration data. 
 

.gclient file

It's the master file. It is, in fact, a python script. It  specifies the following variables:

  • solutions: an array of       dictionaries specifying the projects that will be fetched.  
  • hooks: additional       hooks to be run when this meta checkout is synced.  

Additional variables are ignored. 

Each project described in the solutions array can contain an  optional DEPS file that will be processed. The .gclient file is generated  withgclient config  <url> or by hand. Each solutions entry is a  dictionary that can contain the following variables:

  • name: really, the       path of the checkout.  
  • url: the remote       repository to fetch/clone.  
  • custom_deps:       (optional) override the dependencies specified in the deps and deps_os       variables in child DEPS files. Useful when you want to fetch a writable       checkout instead of the default read-only checkout of a dependency, e.g.       you work on native_client from a chromium checkout.  
  • custom_vars:       (optional) override the variables defined in vars in child DEPS files.       Example: override the WebKit version used for a chromium checkout.  
  • safesync_url:       (optional) url to fetch to retrieve the revision to sync this checkout       to. 

.gclient example

http://dev.chromium.org/developers/contributing-to-webkit  explains how to hack your own .gclient file to modify the checkout to fetch  from webkit's trunk instead of the version specified by chromium. 

DEPS file

A DEPS file specifies dependencies of a project. It is in fact a  python script. It specifies the following variables:  

  • deps: a dictionary       of child dependencies to fetch.  
  • deps_os: a dictionary       of OSes for OS-specific dependencies, each containing a dictionary of       child dependencies to fetch.  
  • vars: a dictionary       of variables to define. Mainly useful to easily override a batch of       revisions at once.  
  • hooks: hooks to run       after a sync.  
  • use_relative_paths:       relative paths should specify the checkout relative to this directory       instead of the root gclient checkout.  

Additional variables are ignored. Specical keywords are: 

  • File(): used for       dependencies, specify to expect to checkout a file instead of a       directory.  
  • From(): used to       fetch a dependency definition from another DEPS file, for chaining.  
  • Var(): replace this       string with a variable defined in vars or overridden. 

Pinned deps

Each dependency checkout URL can (and usually does) contain a  revision number or git hash, which means you're going to check out and build  from that specific revision of the module in question. We call thatpinned  deps. The advantage is that you can build from a known working revision,  even if it comes from a completely different SCM repository or going back in  time. The drawback is you have to update the revision number(s) constantly,  what we calldeps rolls

DEPS examples 

Webkit's WebKit/chromium/DEPS and Chromium's src/DEPS are fairly complex examples that will show all  the possibilities of a DEPS file. 

Sending patches

Something in depot_tools or git-cl-repo is broken? You want to  add a YAT, a yet another tool? You donot need to be a committer! Yay!  

Send a patch to maruel@ or whoever shows up in svn log/git log  to have it fixed. 

If you are a committer, it is strongly advised to have a  writable checkout first, seeinstalling  depot_tools. Then use gcl or git-cl as usual tocontribute code.

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值