【编译CEF3】编译Chromium(CEF3)源代码增加对mp3/mp4等格式支持的编译手记 编译过程中所遇到的问题(2) 2018-5-20
今天正式开始对master分支进行编译工作。
首先检查一下"c:\code\chromium_git\chromium\src"目录中是否有"cef"文件夹,如果没有则把"c:\code\chromium_git"路径下的"cef"文件夹拷贝一份至"c:\code\chromium_git\chromium\src"路径下。
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
PS: 以下摘自官方:
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).
这将生成一个"c:\code\chromium_git\chromium\src\out\Debug_GN_x86\cef.sln"文件,该文件可以在Visual Studio中加载,用于调试和编译单个文件.。在此路径中将"x86"替换为"x64",以使用64位版本而不是32位版本。总是使用Ninja来构建完整的工程。如果更改项目配置或在GN配置(BUILD.gn)中添加/删除文件,请重复此步骤。
在执行的过程中出现了一个错误:
gn.py: Could not find gn executable at: c:\code\chromium_git\chromium\src\buildtools\win\gn.exe
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
![](https://images2018.cnblogs.com/blog/1403781/201805/1403781-20180520205020447-529166258.png)
进入任意一个文件夹都可以看到解决方案"cef.sln",编译预处理成功!: