記錄windows下編譯chromium,備忘

來源:互聯網
上載者:User

標籤:iss   error   .com   tools   檔案夾   開啟   parser   ini   eps   

編譯windows下chromium,時間:20170619,

官方地址:https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md

 一. 系統要求:

1. 64位機器,至少8GB的記憶體,推薦16GB以上。(我用的Win10 64位虛擬機器,記憶體按照8G來的);

2. 至少100GB的硬碟儲存空間,格式為NTFS。FAT32不支援大於4GB的檔案,而在git下載時的檔案可能會有20GB+;

3. Visual studio 2015 update 3;

4. Win7+ (我用的Win10編譯,此處可能有個坑,下文介紹);

二. 系統配置:

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,我一開始安裝的時候,不知為何沒有安裝這個,修複了下後,才有的;

三. 安裝depot_tools:

1. 下載depot_tools bundle,然後解壓,地址:https://storage.googleapis.com/chrome-infra/depot_tools.zip;

2. 將depot_tools放到PATH環境變數的開始位置,至少在你安裝的python和git的前面,因為depot_tools裡面會下載python,如果在你安裝的python後面的話,可能會出一些不可預期的問題;

3. 添加環境變數DEPOT_TOOLS_WIN_TOOLCHAIN,並設為0;

4. 開啟cmd.exe,運行gclient,在第一次啟動並執行時候,gclient會安裝python/msysgit等必要組件;

四. 擷取源碼:

1. 開啟cmd,在你想放置源碼的位置,建立chromium檔案夾並進入,mkdir chromium && cd chromium;

2. fetch chromium;

ps:這裡有個問題,我用的Win10帶的預設的windows defender是開啟的,此時在下載完源碼後會出現:

  1. Traceback (most recent call last):
  2. File "D:\git\google\depot_tools\gclient_scm.py", line 965, in _Clone
  3. os.path.join(self.checkout_path, ‘.git‘))
  4. File "D:\git\google\depot_tools\gclient_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. ----------------------------------------
  9. Traceback (most recent call last):
  10. File "D:\git\google\depot_tools\gclient.py", line 2378, in <module>
  11. sys.exit(main(sys.argv[1:]))
  12. File "D:\git\google\depot_tools\gclient.py", line 2364, in main
  13. return dispatcher.execute(OptionParser(), argv)
  14. File "D:\git\google\depot_tools\subcommand.py", line 252, in execute
  15. return command(parser, args[1:])
  16. File "D:\git\google\depot_tools\gclient.py", line 2117, in CMDsync
  17. ret = client.RunOnDeps(‘update‘, args)
  18. File "D:\git\google\depot_tools\gclient.py", line 1568, in RunOnDeps
  19. work_queue.flush(revision_overrides, command, args, options=self._options)
  20. File "D:\git\google\depot_tools\gclient_utils.py", line 1112, in run
  21. self.item.run(*self.args, **self.kwargs)
  22. File "D:\git\google\depot_tools\gclient.py", line 867, in run
  23. file_list)
  24. File "D:\git\google\depot_tools\gclient_scm.py", line 166, in RunCommand
  25. return getattr(self, command)(options, args, file_list)
  26. File "D:\git\google\depot_tools\gclient_scm.py", line 450, in update
  27. self._Clone(revision, url, options)
  28. File "D:\git\google\depot_tools\gclient_scm.py", line 965, in _Clone
  29. os.path.join(self.checkout_path, ‘.git‘))
  30. File "D:\git\google\depot_tools\gclient_utils.py", line 158, in safe_rename
  31. os.rename(old, new)
  32. WindowsError: [Error 5]
  33. Traceback (most recent call last):
  34. File "D:\git\google\depot_tools\\fetch.py", line 353, in <module>
  35. sys.exit(main())
  36. File "D:\git\google\depot_tools\\fetch.py", line 348, in main
  37. return run(options, spec, root)
  38. File "D:\git\google\depot_tools\\fetch.py", line 342, in run
  39. return checkout.init()
  40. File "D:\git\google\depot_tools\\fetch.py", line 142, in init
  41. self.run_gclient(*sync_cmd)
  42. File "D:\git\google\depot_tools\\fetch.py", line 76, in run_gclient
  43. return self.run(cmd_prefix + cmd, **kwargs)
  44. File "D:\git\google\depot_tools\\fetch.py", line 66, in run
  45. return subprocess.check_output(cmd, **kwargs)
  46. File "D:\git\google\depot_tools\python276_bin\lib\subprocess.py", line 573, in check_output
  47. raise CalledProcessError(retcode, cmd, output=output)
  48. 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就好了,其他殺軟或許有類似的情況,請注意,參考https://bugs.chromium.org/p/chromium/issues/detail?id=464132)

3. 源碼下載成功後,cd src,進入src目錄;

五. 編譯(最期待的時候到了):

1. 首先使用預設的編譯方式吧,使用gn gen out/Default,會在src目錄下建立out/Default目錄,並配置些編譯需要的檔案;

2. 使用ninja -C out\Default 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,順利解決,參考https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/tQGuR7Ur0i8;

3. 編譯好了,運行Default下的chrome.exe吧。

 

記錄windows下編譯chromium,備忘

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.