也是使用这个工具对其代码进行checkout,官方地址

作者: 操作系统  发布:2019-11-20

编译windows下chromium,时间:20170619,

前期操作步骤基本按官方指导来

注1:本文档适用于webrtc和webrtc-android源码的下载和编译;

官方地址:

System requirements

A 64-bit Mac running 10.11+.

Xcode7.3+.

The OS X 10.10 SDK. Run

$ ls`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs

to check whether you have it. Building with a newer SDK works too, but the releases currently use the 10.10 SDK.

Installdepot_tools

Clone thedepot_toolsrepository:

$ git clone

Adddepot_toolsto the end of your PATH (you will probably want to put this in your~/.bashrcor~/.zshrc). Assuming you cloneddepot_toolsto/path/to/depot_tools:

$exportPATH="$PATH:/path/to/depot_tools"

Get the code

Create achromiumdirectory 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 thefetchtool fromdepot_toolsto 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-historyflag tofetch.

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

chromium源码是用git托管的,在clone的过程中报错了,

[0:52:11] fatal: write error: File too large

Traceback (most recent call last):

File "/Volumes/dev/chromium/depot_tools/gclient_scm.py", line 908, in _Clone

self._Run(clone_cmd, options, cwd=self._root_dir, retry=True)

File "/Volumes/dev/chromium/depot_tools/gclient_scm.py", line 1197, in _Run

gclient_utils.CheckCallAndFilterAndHeader(cmd, env=env, **kwargs)

File "/Volumes/dev/chromium/depot_tools/gclient_utils.py", line 303, in CheckCallAndFilterAndHeader

return CheckCallAndFilter(args, **kwargs)

File "/Volumes/dev/chromium/depot_tools/gclient_utils.py", line 549, in CheckCallAndFilter

rv, args, kwargs.get('cwd', None), None, None)

CalledProcessError: Command 'git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress /Volumes/dev/chromium/src/_gclient_src_E27kfa' returned non-zero exit status 128 in /Volumes/dev/chromium/src


通过错误提示找到 git -c core.deltaBaseCacheLimit=2g clone --no-checkout --progress 可能2g不夠,尝试直接用git -c core.deltaBaseCacheLimit=8g clone ... ,发现还是不行。

通过查找资料得知

修改git参数  git config --system core.longpaths=true

然后 执行   gclient sync

因为之前已经clone过一些代码,所以重复 fetch chromium 肯定执行不了。

通过观察,到写文截止还没有报错,晚上挂机明日再看情况。

注2:下载编译所使用的操作系统为Ubuntu 14.04.3 LTS;

 

Chromium和Chromium OS统一使用一个叫做depot_tools的工具的对其源码进行checkout的管理(这有点类似于Android使用repo工具对其源码进行管理一样),作为Chromium其中一个子模块的webrtc而言,也是使用这个工具对其代码进行checkout。这个depot_rools包里面包含了gclient、gcl、git-cl、repo等工具。

一. 系统要求:

  1. 64位机器,至少8GB的内存,推荐16GB以上。(我用的Win10 64位虚拟机,内存按照8G来的);

2. 至少100GB的硬盘存储空间,格式为NTFS。FAT32不支持大于4GB的文件,而在git下载时的文件可能会有20GB+;

  1. Visual studio 2015 update 3;

  2. Win7+ (我用的Win10编译,此处可能有个坑,下文介绍);

下载depot_tools工具包并放到标准路径PATH上:

二. 系统配置:

  1. 安装Visual studio 2015 update3,并安装window sdk 14393,vs需要安装Visual C++的三个选项包括MFC,Universal Windows Apps Development Tools > Tools (1.4.1) and Windows 10 SDK (10.0.14393);

  2. 14393的SDK安装时要安装Debugging Tools For Windows,我一开始安装的时候,不知为何没有安装这个,修复了下后,才有的;

 首先确保Linux上安装了Git 2.2.1以上版本,以及Python 2.7以上版本;

三. 安装depot_tools:

  1. 下载depot_tools bundle,然后解压,地址:

  2. 将depot_tools放到PATH环境变量的开始位置,至少在你安装的python和git的前面,因为depot_tools里面会下载python,如果在你安装的python后面的话,可能会出一些不可预期的问题;

  3. 添加环境变量DEPOT_TOOLS_WIN_TOOLCHAIN,并设为0;

4. 打开cmd.exe,运行gclient,在第一次运行的时候,gclient会安装python/msysgit等必要组件;

   git clone

四. 获取源码:

  1. 打开cmd,在你想放置源码的位置,创建chromium文件夹并进入,mkdir chromium && cd chromium;

  2. fetch chromium;

ps:这里有个问题,我用的Win10带的默认的windows defender是开启的,此时在下载完源码后会出现:

  1. Traceback (most recent call last):
  2. File "D:gitgoogledepot_toolsgclient_scm.py", line 965, in _Clone
  3. os.path.join(self.checkout_path, '.git'))
  4. File "D:gitgoogledepot_toolsgclient_utils.py", line 158, in safe_rename
  5. os.rename(old, new)
  6. WindowsError: [Error 5]
  7. [0:22:25] _____ removing non-empty tmp dir D:google_gclient_src_byzfvs

  8. Traceback (most recent call last):
  9. File "D:gitgoogledepot_toolsgclient.py", line 2378, in <module>
  10. sys.exit(main(sys.argv[1:]))
  11. File "D:gitgoogledepot_toolsgclient.py", line 2364, in main
  12. return dispatcher.execute(OptionParser(), argv)
  13. File "D:gitgoogledepot_toolssubcommand.py", line 252, in execute
  14. return command(parser, args[1:])
  15. File "D:gitgoogledepot_toolsgclient.py", line 2117, in CMDsync
  16. ret = client.RunOnDeps('update', args)
  17. File "D:gitgoogledepot_toolsgclient.py", line 1568, in RunOnDeps
  18. work_queue.flush(revision_overrides, command, args, options=self._options)
  19. File "D:gitgoogledepot_toolsgclient_utils.py", line 1112, in run
  20. self.item.run(*self.args, **self.kwargs)
  21. File "D:gitgoogledepot_toolsgclient.py", line 867, in run
  22. file_list)
  23. File "D:gitgoogledepot_toolsgclient_scm.py", line 166, in RunCommand
  24. return getattr(self, command)(options, args, file_list)
  25. File "D:gitgoogledepot_toolsgclient_scm.py", line 450, in update
  26. self._Clone(revision, url, options)
  27. File "D:gitgoogledepot_toolsgclient_scm.py", line 965, in _Clone
  28. os.path.join(self.checkout_path, '.git'))
  29. File "D:gitgoogledepot_toolsgclient_utils.py", line 158, in safe_rename
  30. os.rename(old, new)
  31. WindowsError: [Error 5]
  32. Traceback (most recent call last):
  33. File "D:gitgoogledepot_tools\fetch.py", line 353, in <module>
  34. sys.exit(main())
  35. File "D:gitgoogledepot_tools\fetch.py", line 348, in main
  36. return run(options, spec, root)
  37. File "D:gitgoogledepot_tools\fetch.py", line 342, in run
  38. return checkout.init()
  39. File "D:gitgoogledepot_tools\fetch.py", line 142, in init
  40. self.run_gclient(*sync_cmd)
  41. File "D:gitgoogledepot_tools\fetch.py", line 76, in run_gclient
  42. return self.run(cmd_prefix + cmd, **kwargs)
  43. File "D:gitgoogledepot_tools\fetch.py", line 66, in run
  44. return subprocess.check_output(cmd, **kwargs)
  45. File "D:gitgoogledepot_toolspython276_binlibsubprocess.py", line 573, in check_output
  46. raise CalledProcessError(retcode, cmd, output=output)
  47. subprocess.CalledProcessError: Command '('D:\git\google\depot_tools\python276_bin\python.exe', 'D:\git\google\depot_tools\gclient.py', 'sync', '--no-history')' returned non-zero exit status 1

这样的问题,主要是杀软拦截导致删除文件目录失败,禁用掉WinDefender就好了,其他杀软或许有类似的情况,请注意,参考

  1. 源码下载成功后,cd src,进入src目录;

   修改HOME目录中的.bashrc文件,在最后增加:PATH="~/bin/depot_tools:$PATH",注意一定要把depot_tools的位置放在PATH的最前面;

五. 编译(最期待的时候到了):

  1. 首先使用默认的编译方式吧,使用gn gen out/Default,会在src目录下创建out/Default目录,并配置些编译需要的文件;

  2. 使用ninja -C outDefault chrome命令行编译chrome,此时需要等待漫长的时间;

ps:在使用ninja编译的时候,我这里出现了

ninja: Entering directory `out/Default'
ninja: error: '../../native_client/toolchain/mac_x86/pnacl_newlib/bin/x86_64-nacl-objcopy', needed by 'irt_x64/obj/ppapi/native_client/nacl_irt_debuglink.inputdeps.stamp', missing and no known rule to make it

这种类似的错误,在src目录下使用cmd执行gclient sync,顺利解决,参考

  1. 编译好了,运行Default下的chrome.exe吧。

 

参考:

下载webrtc-native代码及编译流程(首先要先按照以上步骤下载depot_tools):

mkdir webrtc-checkout

cd webrtc-checkout

fetch --nohooks webrtc

gclient sync//代码下载过程中如果发生中断,使用gclient sync同步就可以了

cd src/

./build/install-build-deps.sh(只需要在第一次gclient sync以后执行一次)

gn gen out/Default

ninja -C out/Default

gn clean out/Default

下载webrtc-android代码及编译流程(首先要先按照以上步骤下载depot_tools ):

mkdir webrtc-android

cd webrtc-android

fetch --nohooks webrtc_android

gclient sync//代码下载过程中如果发生中断,使用gclient sync同步就可以了

cd src/

./build/install-build-deps.sh(只需要在第一次gclient sync以后执行一次)

gn gen out/Debug --args='target_os="android" target_cpu="arm"'

ninja -C out/Debug

gn clean out/Debug

编译和安装AppRTCMobile :

ninja -C out/Default AppRTCMobile

adb install -r out/Default/apks/AppRTCMobile.apk

WebRTC代码后期更新的三种方式(在src目录下):

   当前代码在某个分支下进行维护,使用git pull可以拉取远程仓库的最新更新;

   当前代码不在分支下,使用git fetch取下来最新的git仓库更新;

   需要定期更新依赖或者其他第三方库,使用gclient sync命令;

附录:

1.webrtc-android版本下载及编译过程中存在play_services不存在的问题

问题描述:

下载完成后执行:gn gen out/Debug --args='target_os="android" target_cpu="arm"'命令出现以下打印错误:

pavel@ubuntu-han:~/webrtc-android/src$ gn gen out/Debug --args='target_os="android" target_cpu="arm"'

ERROR at //build/config/android/rules.gni:2739:9: Script returned non-zero exit code.       exec_script("//build/android/gyp/aar.py",

       ^----------

Current dir: /home/pavel/webrtc-android/src/out/Debug/

Command: python -- /home/pavel/webrtc-android/src/build/android/gyp/aar.py --input-file ../../third_party/android_tools/sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/10.2.0/play-services-basement-10.2.0.aar --list

Returned 1.

stderr:

Traceback (most recent call last):

 File "/home/pavel/webrtc-android/src/build/android/gyp/aar.py", line 114, in <module>

   sys.exit(main())

 File "/home/pavel/webrtc-android/src/build/android/gyp/aar.py", line 81, in main

   with zipfile.ZipFile(aar_file) as z:

 File "/usr/lib/python2.7/zipfile.py", line 701, in __init__

   self.fp = open(file, modeDict[mode])

IOError: [Errno 2] No such file or directory: '../../third_party/android_tools/sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/10.2.0/play-services-basement-10.2.0.aar'

See //third_party/android_tools/BUILD.gn:191:1: whence it was called.

android_aar_prebuilt("google_play_services_basement_java") {

^-----------------------------------------------------------

See //webrtc/system_wrappers/BUILD.gn:155:7: which caused the file to be included.   "//third_party/android_tools:cpu_features",

     ^-----------------------------------------

解决办法:

通过对该问题进行跟踪和查询,应该是在下载play services框架的时候有一个license需要yes才可以,执行以下命令重新启动play services的下载并在下载的过程中许可license:

./src/build/android/play_services/update.py download

2.webrtc-android版本编译出现的jni问题

问题描述:

pavel@ubuntu-han:~/webrtc-android/src$ ninja -C out/Debug/

ninja: Entering directory `out/Debug/'

[3/7329] ACTION //base:android_runtime_jni_headers__jni_Runtime(//build/toolchain/android:android_arm)

FAILED: gen/android_runtime_jni_headers/base/jni/Runtime_jni.h

python ../../base/android/jni_generator/jni_generator.py --depfile gen/base/android_runtime_jni_headers__jni_Runtime.d --jar_file ../../third_party/android_tools/sdk/platforms/android-24/android.jar --input_file java/lang/Runtime.class --optimize_generation=1 --ptr_type=long --output_dir gen/android_runtime_jni_headers/base/jni --includes ../../../../../../base/android/jni_generator/jni_generator_helper.h --native_exports_optional

Traceback (most recent call last):

 File "../../base/android/jni_generator/jni_generator.py", line 1418, in <module>

   sys.exit(main(sys.argv))

 File "../../base/android/jni_generator/jni_generator.py", line 1411, in main

   GenerateJNIHeader(input_file, output_file, options)

 File "../../base/android/jni_generator/jni_generator.py", line 1314, in GenerateJNIHeader

   jni_from_javap = JNIFromJavaP.CreateFromClass(input_file, options)

 File "../../base/android/jni_generator/jni_generator.py", line 663, in CreateFromClass

   stderr=subprocess.PIPE)

 File "/usr/lib/python2.7/subprocess.py", line 679, in __init__

   errread, errwrite)

 File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child

9159金沙官网,   raise child_exception

OSError: [Errno 2] No such file or directory

[4/7329] CXX obj/base/base_paths/base_paths_android.o

解决办法:

出现以上问题是由于当前系统中缺少一些编译webrtc-android的组件,需要调用以下两个脚本在当前系统中安装必要的组件即可:

./build/install-build-deps.sh

./build/install-build-deps-android.sh

本文由9159.com发布于操作系统,转载请注明出处:也是使用这个工具对其代码进行checkout,官方地址

关键词:

上一篇:从数据库,对数据进行备份
下一篇:没有了