【編譯CEF3】編譯Chromium(CEF3)源代碼增長對mp3/mp4等格式支持的編譯手記 編譯過程當中所遇到的問題(2) 2018-5-20

       今天正式開始對master分支進行編譯工做。html

        首先檢查一下"c:\code\chromium_git\chromium\src"目錄中是否有"cef"文件夾,若是沒有則把"c:\code\chromium_git"路徑下的"cef"文件夾拷貝一份至"c:\code\chromium_git\chromium\src"路徑下。python

 

1.在路徑"c:\code\chromium_git\chromium\src\cef"下建立腳本"create.bat"並添加代碼:git

set CEF_USE_GN=1 set GN_DEFINES=use_jumbo_build=true set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
call cef_create_projects.bat

打開"cmd.exe"並運行"create.bat"腳本:windows

cd c:\code\chromium_git\`chromium\src\cef create.bat

PS: 如下摘自官方:ide

This will generate a "c:\code\chromium_git\chromium\src\out\Debug_GN_x86\cef.sln" file that can be loaded in Visual Studio for debugging and compiling individual files. Replace 「x86」 with 「x64」 in this path to work with the 64-bit build instead of the 32-bit build. Always use Ninja to build the complete project. Repeat this step if you change the project configuration or add/remove files in the GN configuration (BUILD.gn file).ui

這將生成一個"c:\code\chromium_git\chromium\src\out\Debug_GN_x86\cef.sln"文件,該文件能夠在Visual Studio中加載,用於調試和編譯單個文件.。在此路徑中將"x86"替換爲"x64",以使用64位版本而不是32位版本。老是使用Ninja來構建完整的工程。若是更改項目配置或在GN配置(BUILD.gn)中添加/刪除文件,請重複此步驟。this

在執行的過程當中出現了一個錯誤:spa

gn.py: Could not find gn executable at: c:\code\chromium_git\chromium\src\buildtools\win\gn.exedebug

Tracebck (most recent cll lst):調試

    File "tools\gclient_hook.py" , line 133, in <module>

          RunAction(src_dir, cmd)

   File "c:\code\chromium_git\chromium\src\cef\tools\gclient_util.py", line 39, in RunAction

          gclient_utils.CheckCallAndFilterndHeder(command, cmd=dir, always=True)

   File "c:\code\depot_tools\gclient_utils.py", line 314, in CheckCallAndFilterAndHeader

          return CheckCllAndFilter(args, **kwargs)

   File "c:\code\depot_tools\gclient_utils.py", line 576, in CheckCallAndFilter

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

檢查了一下在文件夾"c:\code\chromium_git\chromium\src\buildtools\win"中並無找到"gn.exe",應該是代碼沒有下載完整,因而參考 前輩 所提供的解決方案進行如下配置:

打開腳本文件"c:\code\chromium_git\update.bat",將其中內容更改成:

set CEF_USE_GN=1 set GN_DEFINES=use_jumbo_build=true set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
python ..\automate\automate-git.py --download-dir=c:\code\chromium_git --depot-tools-dir=c:\code\depot_tools --no-distrib --no-build --no-depot-tools-update --force-clean --force-update

保存關閉文件,打開"cmd.exe"從新運行"update.bat"腳本:

cd c:\code\chromium_git update.bat

等待其執行完畢後在次打開文件夾"c:\code\chromium_git\chromium\src\buildtools\win"便可看到"gn.exe"文件了。

解決完問題,繼續編譯:

重複第1步,建立"create.bat"腳本並執行:

1.在路徑"c:\code\chromium_git\chromium\src\cef"下建立腳本"create.bat"並添加代碼:

set CEF_USE_GN=1 set GN_DEFINES=use_jumbo_build=true set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
call cef_create_projects.bat

打開"cmd.exe"並運行"create.bat"腳本:

cd c:\code\chromium_git\`chromium\src\cef create.bat

 ( ̄へ ̄)還沒來得及高興,第二個錯誤又出現了:

Traceback (most recent call last):
File "C:/code/chromium_git/chromium/src/build/vs_toolchain.py", line 489, in <module>
sys.exit(main())
File "C:/code/chromium_git/chromium/src/build/vs_toolchain.py", line 485, in main
return commands[sys.argv[1]](*sys.argv[2:])
File "C:/code/chromium_git/chromium/src/build/vs_toolchain.py", line 313, in CopyDlls
_CopyDebugger(target_dir, target_cpu)
File "C:/code/chromium_git/chromium/src/build/vs_toolchain.py", line 344, in _CopyDebugger
' 10 SDK.' % (debug_file, full_path))
Exception: dbghelp.dll not found in "C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\dbghelp.dll"
You must install the "Debugging Tools for Windows" feature from the Windows 10 SDK.
ERROR at //build/toolchain/win/BUILD.gn:43:3: Script returned non-zero exit code.
exec_script("../../vs_toolchain.py",
^----------

查了查文件發如今"C:\Program Files (x86)\Windows Kits\10\"下並無"Debugger"文件夾,不知道什麼緣由,嘗試手動下載Windows 10 SDK(https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)進行安裝後再次重複第1步,建立"create.bat"腳本並執行:

1.在路徑"c:\code\chromium_git\chromium\src\cef"下建立腳本"create.bat"並添加代碼:

set CEF_USE_GN=1 set GN_DEFINES=use_jumbo_build=true set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
call cef_create_projects.bat

打開"cmd.exe"並運行"create.bat"腳本:

cd c:\code\chromium_git\`chromium\src\cef create.bat

╮( ̄▽ ̄)╭ yeah!,此次腳本終於能順利的跑到底了,執行完成後在路徑"c:\code\chromium_git\chromium\src\out"下出現了4個文件夾:
 

進入任意一個文件夾均可以看到解決方案"cef.sln",編譯預處理成功!:

相關文章
相關標籤/搜索