webRTC 安装(系统Ubuntu14.04)

Depot Tools

Installing on Linux and Mac

1. Confirm Git is installed. git 2.2.1+ recommended.

2. Fetch depot_tools: 

[cpp]  view plain  copy
 
  1. $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git  
3. Add  depot_tools  to your  PATH :

[cpp]  view plain  copy
 
  1. $ export PATH=`pwd`/depot_tools:"$PATH"  
  • Yes, you want to put depot_tools ahead of everything else, otherwise gcl will refer to the GNU Common Lisp compiler.
  • You may want to add this to your.bashrc file or your shell's equivalent so that you don’t need to reset your $PATH manually each time you open a new shell.
依赖的一些库:

Here is a (hopefully complete) minimal list of packages to install (sudo apt-get install...):

[cpp]  view plain  copy
 
  1. g++ (>= 4.2)  
  2. python (>= 2.4)  
  3. libnss3-dev >= 3.12  
  4. libasound2-dev  
  5. libpulse-dev  
  6. libjpeg62-dev  
  7. libxv-dev  
  8. libgtk2.0-dev  
  9. libexpat1-dev  
To create 32-bit builds for Linux on a 64-bit system (not needed or Android builds):
[cpp]  view plain  copy
 
  1. lib32asound2-dev  
  2. lib32z1  
  3. lib32ncurses5  
  4. lib32bz2-1.0  

获取WebRTC源码

针对桌面开发环境

1. If you're on Linux and have OpenJDK 7 installed in another location than Ubuntu's default:

[cpp]  view plain  copy
 
  1. export JAVA_HOME=  
2. On Windows: launch a command prompt as Administrator.

3. Create a working directory, enter it, and runfetch webrtc:o

[cpp]  view plain  copy
 
  1. mkdir webrtc-checkout  
  2. cd webrtc-checkout  
  3. fetch --nohooks webrtc  
  4. gclient sync  

只有 export PATH=`pwd`/depot_tools:"$PATH"之后,上述的fetch和gclient才能生效。

这个过程非常漫长,通常我都是晚上sync,第二天早上才完毕,中间经常会遇到出错的问题,需要多重试几次才行。我sync时遇到的最多的问题如下:

[cpp]  view plain  copy
 
  1. __running '/usr/bin/python src/tools/clang/scripts/update.py --if-needed' in '/home/gsc/webrtc-checkout/src/chromium'  
  2.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  Dload  Upload   Total   Spent    Left  Speed  
  3. 100 28.4M  100 28.4M    0     0   278k      0  0:01:44  0:01:44 --:--:--  468k  
  4. Trying to download prebuilt clang  
  5. clang 247874-1 unpacked  
  6. Hook '/usr/bin/python src/tools/clang/scripts/update.py --if-needed' took 105.09 secs  
多同步几次, ping android.googlesource.com看看通不通,通的话失败了就sync,整个过程不能出错,一旦出错就会导致编译异常。我整个下载下来10G多一点。

源码更新

如果代码下载完成了,更新命令是:

[cpp]  view plain  copy
 
  1. git pull  

Peridically, the build toolchain and dependencies of WebRTC are updated. To get such updates, you must run:

[cpp]  view plain  copy
 
  1. gclient sync  

In addition to downloading dependencies this also generates native build files for your environment using GYP   during the execution of the hooks in the DEPS file. These hooks can also be run separately using gclient runhooks).

Ninja is the default build system for all platforms. It is possible to just generate new build files by calling:

[cpp]  view plain  copy
 
  1. python webrtc/build/gyp_webrtc  
This also runs as a part of the  gclient runhooks  step.

代码编译

Binaries are by default (i.e. when building with ninja) generated in   out/Debug andout/Release  for debug and release builds respectively.  See Android  and  iOS  for build instructions specific to those platforms .

With Ninja

Ninja project files are normally generated during the gclient sync/runhooks step. If you need to re-generate only the ninja files (like if you've wiped your out  folder), run
[cpp]  view plain  copy
 
  1. python webrtc/build/gyp_webrtc  
Then compile with (standing in  src/ ):
Debug:
[cpp]  view plain  copy
 
  1. ninja -C out/Debug  
Release:

[cpp]  view plain  copy
 
  1. ninja -C out/Release  

参考以下连接:http://www.webrtc.org/native-code/development

你可能感兴趣的:(配置)