Ubuntu14.04编译Webrtc

该文章为自己原创,现在博客搬家,从新整理了下:


1. install dep packages.

     sudo apt-get install git subversion g++ pkg-config gtk+-2.0 libnss3-dev libudev-dev ant gcc-multilib lib32z1 lib32stdc++6 python libexpat1-dev

     sudo add-apt-repository ppa:git-core/ppa

     sudo apt-get update

     sudo apt-get install git-svn


2.  install jdk

     Download jdk-6u45-linux-x64.bin http://uni-smr.ac.ru/archive/dev/java/SDKs/sun/j2se/6/
     $sudo mkdir –p /usr/lib/jvm
     $cd /usr/lib/jvm && sudo /bin/sh ~/jdk-6u45-linux-x64.bin --noregister


     Register JDK in the system
     $sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 50000
     $sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 50000
     $sudo update-alternatives --config javac
     $sudo update-alternatives --config java
     $cd /usr/lib
     $sudo ln -s /usr/lib/jvm/jdk1.6.0_45 java-6-sun

     Add JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45/ in the end of file  ~/.bashrc


3.  download source code.

     $mkdir webrtc
     $cd webrtc
     $gclient config --name src 'git+https://chromium.googlesource.com/external/webrtc'
     $echo "target_os = ['android', 'unix']" >> .gclient
     $gclient sync -j200(Will take a long time and you must see the NOTICE)
     (It took almost a day because i am in china and using VPN, .....................)
     $cd src 
     $git svn init --prefix=origin/ https://webrtc.googlecode.com/svn -Ttrunk --rewrite-root=http://webrtc.googlecode.com/svn
     $git config svn-remote.svn.fetch trunk:refs/remotes/origin/master
     $git svn fetch
     $git checkout master

NOTICE:
   For webrtc's bug, you should do as below when got this "Failure: 'NoneType' object is not callable" during gclient sync.
   $cd src
   $vim DEPS 
    (Delete this in the src/DEPS)
    {
      $ Download test resources, i.e. video and audio files from Google Storage.
      "pattern": ".",
      "action": ["download_from_google_storage",
                 "--directory",
                 "--recursive",
                 "--num_threads=10",
                 "--no_auth",
                 "--bucket", "chromium-webrtc-resources",
                 "src/resources"],
    },


   $git commit -a -m "DEPS: remove download_from_google_storage"
   $gclient sync -r b7e8c67cf209bfb5e3b5b2d(commitloghash of "DEPS: remove download_from_google_storage")
   $cd .. && gclient sync -j200(after finish download the sourcecode doing "git reset --hard HEAD^" in src/)


4.  Install build-deps packages.
     $cd src
     $./build/install-build-deps.sh


5.  Build the source code.
     $cd src
     $source ./build/android/envsetup.sh
     $export GYP_DEFINES="$GYP_DEFINES OS=android"
     $ninja -C out/Debug WebRTCDemo(The file number need to compile > 4000)

6.  Handle the java compile error(APILevel 21 is too high):
     add below line in ~/.bashrc
     PATH=$PATH:/home/simon/Worksapce/Android/sdk/adt-bundle-linux-x86_64-20140702/sdk/tools

     $cd src/talk/examples/android
     $android update project -p . -t android-20
     $cd - 
     $ninja -C out/Debug

/*****NOTICE*****/
(If you copy your sourcecode to other place, you need only doing this for genarate the build struct for ninja)
(如果你的代码位置变动,需要重新配置编译环境,代码如下)
$/usr/bin/python src/webrtc/build/gyp_webrtc  -Dextra_gyp_flag=0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值