VC编程之VC2012编译CEF3
小标 2018-09-04 来源 : 阅读 1844 评论 0

摘要:本文主要向大家介绍了VC编程之VC2012编译CEF3,通过具体的内容向大家展示,希望对大家学习VC编程有所帮助。

本文主要向大家介绍了VC编程之VC2012编译CEF3,通过具体的内容向大家展示,希望对大家学习VC编程有所帮助。

下载
代码下载://cefbuilds.com/,CEF 3.2556.1368.g535c4fb
解压到本地:D:\Develop\CEF3\cef_binary_3.2526.1361.g456ea5a_windows32
配置
下载最新的CMake,比如//www.onlinedown.net/softdown/254393_2.htm
安装CMake后运行gui,设置使用VC2012,操作过程可参考//blog.sina.com.cn/s/blog_53b7ddf00101mjo7.html
编译
最后进入D:\Develop\CEF3\cef_binary_3.2526.1361.g456ea5a_windows32\build
使用VC2012打开cef.sln,在IDE下build solution
warning C4610/C4510
 
[cpp] view plain copy
 
typedef const struct __log_rec_spec {  
    log_rec_type_t  type;  
    u_int32_t   offset;  
    const char  *name;  
    const char  fmt[4];  
} DB_LOG_RECSPEC;  
关闭这种警告C/C++,Advanced,Disable Specific Warnings:4100;4127;4244;4481;4512;4701;4702;4996;4510;4610
 
关于_HAS_EXCEPTIONS
CEF3项目默认的编译开关是_HAS_EXCEPTIONS=0,这会在有些情况下导致编译错误,比如有些Windows平台上的std库无法使用而产生的编译错误,这时候需要开启_HAS_EXCEPTIONS
设置:
_HAS_EXCEPTIONS=1  必须同时设置EHsc
Code Generation --> Enable C++ Exceptions: EHsc
配置命令行commandline
比如使用--disable-web-security,有两种使用方式
启动:cef.exe --disable-web-security
代码实现:AppendSwitch,AppendArgument,在代码中使用前面的两个横线就不需要了,AppendSwitch("disable-gpu")
注意:--disable-web-security有可能会影响屏幕中iframe的尺寸,进而影响到css,@media screen and (max-width : 1024px),比如没有设置--disable-web-security,@media screen and (max-width : 1024px)中的样式不会包含到页面中,如果设置了--disable-web-security,@media screen and (max-width : 1024px)中的样式就会起作用,从而影响了页面的显示
关于iframe
比如我们想知道当前iframe的路径,使用js怎么做?
html
 
[html] view plain copy
 
<div class="panel-width-start" id="map">  
    <iframe allowTransparency=true name="I2" id="site" frameborder="0" src="//www.58.com/changecity/"></iframe>  
</div>  
js
 
 
[javascript] view plain copy
 
var currentUrl = document.getElementById("site").contentWindow.location.href;  
这样可以一直获取到iframe当前页面的url,运行CEF3必须使用--disable-web-security,否则js执行会失败,告诉你当前为跨域操作不允许
控件显示与manifest
如果修改既有的cefclient工程,比如你修改了项目的名称,可执行exe的文件名,这时需要注意Post-Build Event中需要做相应的修改
mt.exe -nologo -manifest "D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/cefclient/resources/win/cefclient.exe.manifest" "D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/cefclient/resources/win/compatibility.manifest" -outputresource:"D:/Develop/CEF3/cef_binary_3.2623.1401.gb90a3be_windows32/build/cefclient/Debug/UI_example.exe";#1
常见问题
warning C4510:‘ATL::_NoAddRefReleaseOnCComPtr<T>‘ : default constructor could not begenerated
配置时,关闭-DUSE_ATL=Off to CMake
error C2220: warning treated as error - no ‘object‘ file generated
解决办法:参考//blog.csdn.net/home1410/article/details/6004089
即:报错的文件头部添加类似#pragma warning(disable: 4510 4610) // tiplip
 
 
编译错误
gdiplusimaging.h(74) error c4430 missing type specifier - int assumed
我在window_test_win.cc中需要用到gdiplus,于是添加#include <gdiplus.h>编译报错
答案://stackoverflow.com/questions/3489373/visual-studio-c-2010-express-gets-errors-using-gdi
If you have this line somewhere before the inclusion of <windows.h>
#define WIN32_LEAN_AND_MEAN 
Then comment it out.
#define WIN32_LEAN_AND_MEAN啥意思? 
支持flash
使用Chrome带的pepflashplayer.dll
以下两种方法的版本号可以省去,在CEF3.2623版本上测试有效
启用命令行
 
[plain] view plain copy
 
--ppapi-flash-path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\53.0.2785.143\\PepperFlash\\pepflashplayer.dll" --ppapi-flash-version=23.0.0.162  
版本需要对于,比如都是32位的
 
使用代码
 
[cpp] view plain copy
 
command_line->AppendSwitchWithValue("ppapi-flash-path","pepflashplayer.dll");  
//command_line->AppendSwitchWithValue("ppapi-flash-version","23.0.0.162");  
 
 
具体位置
void ClientAppBrowser::OnBeforeCommandLineProcessing
不使用代理
启动参数:
--no-proxy-server=1
自定义添加资源resource
cefclient.rc文件
比如添加网页html文件,手动添加如下一行
 
[cpp] view plain copy
 
IDS_ORDER_HTML          256                     "..\\root_lottery\\order.html"  
然后编译build,会产生新的resource.h文件,如下所述
 
resource.h文件
有两处resource.h文件,
\cefclient\resources\win\resource.h,编译cefclient.rc产生
\cefclient\browser\resource.h,手动修改,数值来自上面的resource.h文件
支持Windows XP
官方论坛显示,最后一个支持Windows XP的CEF3版本号为,3.2623.1401.gb90a3be
使用VC2012编译XP版本时,需要选择Visual Studio 2012 - Windows XP (v110_xp)
这样编译出来的exe,如果出现浏览器黑屏,可以尝试启动选项:--disable-gpu
截屏Screen Capture
参考
//stackoverflow.com/questions/38512422/add-suport-for-chromium-embedded-framework-to-screen-sharing
测试版本,2924上验证通过,使用--enable-media-stream --enable-usermedia-screen-capturing
测试网址
https://mgechev.github.io/jscapture/
支持HTTP HTTPS Mixed Content
比如给当前页面加载资源时,如果页面本身的url以https开始,那么加载http的资源时会报类似错误
 
[plain] view plain copy
 
2 Mixed Content: The page at ‘https://www.xxxx.com‘ was loaded over HTTPS, but requested an insecure script  
 
 
解决办法
 
[cpp] view plain copy
 
command_line->AppendSwitch("allow-running-insecure-content");  
 
Render与Browser的进程间交互
自定义JS函数操作与Browser相关的功能,比如修改窗口,传递参数
参考://blog.csdn.net/foruok/article/details/50584985
JS binding中传递JSON给C++
参数传递
参考代码Cef_message_router.cc (libcef_dll\wrapper)    38985    2016/5/13
[cpp] view plain copy
 
if (name == config_.js_query_function) {  
  if (arguments.size() != 1 || !arguments[0]->IsObject()) {  
    exception = "Invalid arguments; expecting a single object";  
    return true;  
  }  
  
  CefRefPtr<CefV8Value> arg = arguments[0];  
  
  CefRefPtr<CefV8Value> requestVal = arg->GetValue(kMemberRequest);  
  if (!requestVal.get() || !requestVal->IsString()) {  
    exception = "Invalid arguments; object member ‘"+  
                std::string(kMemberRequest) +"‘ is required and must "  
                "have type string";  
    return true;  
  }  
 
参数类型互换
参考://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11104#
拖拽截取页面的图片
参考问答://stackoverflow.com/questions/28099145/creating-a-drag-select-screen-capture-for-google-chrome
demo://jsfiddle.net/x2xmjrya/
下载编译chromium支持MP3/MP4
2623.mp3.4_x_frame
背景
使用了VPN和http代理
参考
//www.cnblogs.com/himax/p/how_to_build_cef3_on_windows.html
和https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
文件夹结构
设置环境变量
2785及更老版本使用GYP
 
[plain] view plain copy
 
DEPOT_TOOLS_WIN_TOOLCHAIN=0  
  
GYP_DEFINES=buildtype=Official  
  
GYP_GENERATORS=ninja,msvs-ninja  
  
GYP_MSVS_VERSION=2015  
 
2785以后的版本使用GN
 
[plain] view plain copy
 
CEF_USE_GN=1  
GN_DEFINES=is_official_build=true  
GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*  
 
如果需要支持MP3/MP4
 
[vb] view plain copy
 
set CEF_USE_GN=1  
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome  
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*  
call cef_create_projects.bat  
注意:编译过程中,最好关闭其他程序,因为最新official版本的编译需要占用大量的内存RAM,> 8G,理想的内存最好是 14G
 
 
以及Path
 
 
[plain] view plain copy
 
Control Panel → System and Security → System → Advanced system settings  
Modify the PATH system variable to include D:\Work_area\CEF3\depot_tools  
 
编译过程命令汇总
首次编译
 
[plain] view plain copy
 
d:  
cd Work_area\CEF3  
set http_proxy=//cn-proxy.jp.oracle.com:80  
gclient  
git config --global http.proxy %http_proxy%  
python automate-git.py --download-dir=D:\Work_area\CEF3\source --depot-tools-dir=D:\Work_area\CEF3\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --no-build  
 
按照这个命令步骤,如果遇到问题
修改个别文件后的编译
直接在第一层目录下执行
 
[plain] view plain copy
 
python automate-git.py --download-dir=c:\src\source --depot-tools-dir=c:\src\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --force-build  
 
编译参数说明
[plain] view plain copy
 
set http_proxy=//www-proxy.us.oracle.com:80  
gclient  
git config --global http.proxy %http_proxy%  
python automate-git.py --download-dir=c:\src\source --depot-tools-dir=c:\src\depot_tools --branch=2623  --checkout=b90a3be1860b0647e8a62c218ff7c054390365b1 --force-build  
  
--branch=XXXX 指定cef的branch,指定后,会默认下载该branch的cef,以及最新版本的chromium再自动切换到对应版本  
--checkout 手动指定cef的commit(可选参数)  
--chromium-checkout 手动指定chromium的版本(可选参数)  
--no-debug-build 不生成Debug版本,即不生成开发需要的libcef_dll_wrapper库(可选参数)  
--force-clean 强制清除所有chromium的生成项,将源码回档到未编译前,清除后需要重新下载(可选参数)  
--force-build 强制进行编译,重新开始或者继续之前的工作(可选参数)  
--no-update 不再更新cef和chromium(可选参数)  
 
 
可能遇到的错误及解决办法
执行gclient出现如下错误:
 
[plain] view plain copy
 
C:\Windows\System32>gclient  
Installing python 2.7.6...  
Fetching from https://src.chromium.org/svn/trunk/tools/third_party/python276_bin  
.zip  
[-] XMLHTTP 80072ee2: Cannot make HTTP request (操作超时  
  
... Failed to checkout python automatically.  
You should get the "prebaked" version at https://src.chromium.org/svn/trunk/tool  
s/third_party/  
系统找不到指定的路径。  
 
 
说明当前你的电脑可能是通过代理访问的,需要修改depot_tools\bootstrap\win\get_file.js如下:
 
[javascript] view plain copy
 
function Download(url, path, verbose) {  
  if (verbose) {  
    WScript.StdOut.Write(" *  GET " + url + "...");  
  }  
  try {  
    xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP");  
  } catch (e) {  
    WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
        ": Cannot create Active-X object (" + e.description) + ").";  
    WScript.Quit(1);  
  }  
  try {  
    xml_http.open("GET", url, false);  
  } catch (e) {  
    WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
        ": invalid URL.");  
    WScript.Quit(1);  
  }  
改为
 
 
[javascript] view plain copy
 
function Download(url, path, verbose) {  
  if (verbose) {  
    WScript.StdOut.Write(" *  GET " + url + "...");  
  }  
  try {  
    xml_http = new ActiveXObject("MSXML2.ServerXMLHTTP.6.0");  
  } catch (e) {  
    WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
        ": Cannot create Active-X object (" + e.description) + ").";  
    WScript.Quit(1);  
  }  
  try {  
    xml_http.setProxy(2, "cn-proxy.jp.oracle.com:80");  
    xml_http.open("GET", url, false);  
  } catch (e) {  
    WScript.StdOut.WriteLine("[-] XMLHTTP " + new Number(e.number).toHex() +  
        ": invalid URL.");  
    WScript.Quit(1);  
  }  
 
执行
 
[plain] view plain copy
 
python automate-git.py  
错误
 
 
[plain] view plain copy
 
python automate-git.py --download-dir=D:\Develop\CEF3\Compile\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357 --checkout=d66017718b0f0d44da42b706c3c2aa5c0c103852 --no-build  
 
[plain] view plain copy
 
D:\Develop\CEF3\Compile>python automate-git.py --download=D:\Develop\CEF3\Compil  
e\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357 --n  
o-build  
--> Download Directory: D:\Develop\CEF3\Compile\source  
--> Depot Tools Directory: D:\Develop\CEF3\Compile\depot_tools  
--> Updating depot_tools  
-------- Running "update_depot_tools.bat" in "D:\Develop\CEF3\Compile\depot_tool  
s"...  
fatal: unable to access ‘https://chromium.googlesource.com/chromium/tools/depot_  
tools.git/‘: Failed connect to chromium.googlesource.com:443; No error  
Cannot rebase: You have unstaged changes.  
Please commit or stash them.  
Failed to update depot_tools.  
--> CEF Branch: 2357  
--> CEF URL: https://bitbucket.org/chromiumembedded/cef.git  
--> CEF Source Directory: D:\Develop\CEF3\Compile\source\cef  
-------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat clone https://bitb  
ucket.org/chromiumembedded/cef.git D:\Develop\CEF3\Compile\source\cef" in "D:\De  
velop\CEF3\Compile\source"...  
Cloning into ‘D:\Develop\CEF3\Compile\source\cef‘...  
fatal: unable to access ‘https://bitbucket.org/chromiumembedded/cef.git/‘: Faile  
d connect to bitbucket.org:443; No error  
Traceback (most recent call last):  
  File "automate-git.py", line 662, in <module>  
    depot_tools_dir)  
  File "automate-git.py", line 55, in run  
    shell=(sys.platform == ‘win32‘))  
  File "D:\Develop\CEF3\Compile\depot_tools\python276_bin\lib\subprocess.py", li  
ne 540, in check_call  
    raise CalledProcessError(retcode, cmd)  
subprocess.CalledProcessError: Command ‘[‘D:\\Develop\\CEF3\\Compile\\depot_tool  
s\\git.bat‘, ‘clone‘, ‘https://bitbucket.org/chromiumembedded/cef.git‘, ‘D:\\Dev  
elop\\CEF3\\Compile\\source\\cef‘]‘ returned non-zero exit status 128  
 
 
执行gclient前设置代理
 
[plain] view plain copy
 
Microsoft Windows [版本 6.1.7601]  
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。  
  
C:\windows\system32>netsh  
netsh>winhttp  
netsh winhttp>show proxy  
  
当前的 WinHTTP 代理服务器设置:  
  
    代理服务器:  http=cn-proxy.jp.oracle.com  
    绕过列表     :  (无)  
  
netsh winhttp>set proxy cn-proxy.jp.oracle.com:80  
  
当前的 WinHTTP 代理服务器设置:  
  
    代理服务器:  cn-proxy.jp.oracle.com:80  
    绕过列表     :  (无)  
  
netsh winhttp>exit  
  
  
C:\windows\system32>set http_proxy=//cn-proxy.jp.oracle.com:80  
  
C:\windows\system32>git config -global http.proxy %http_proxy%  
error: did you mean `--global` (with two dashes ?)  
  
C:\windows\system32>git config --global http.proxy %http_proxy%  
  
C:\windows\system32>git config --get http.proxy  
//cn-proxy.jp.oracle.com:80  
  
C:\windows\system32>d:  
  
D:\>cd Develop\CEF3\Compile  
  
D:\Develop\CEF3\Compile>python automate-git.py --download-dir=D:\Develop\CEF3\Co  
mpile\source --depot-tools-dir=D:\Develop\CEF3\Compile\depot_tools --branch=2357  
 --checkout=d66017718b0f0d44da42b706c3c2aa5c0c103852 --no-build  
--> Download Directory: D:\Develop\CEF3\Compile\source  
--> Depot Tools Directory: D:\Develop\CEF3\Compile\depot_tools  
--> Updating depot_tools  
-------- Running "update_depot_tools.bat" in "D:\Develop\CEF3\Compile\depot_tool  
s"...  
Cannot rebase: You have unstaged changes.  
Please commit or stash them.  
Failed to update depot_tools.  
--> CEF Branch: 2357  
--> CEF URL: https://bitbucket.org/chromiumembedded/cef.git  
--> CEF Source Directory: D:\Develop\CEF3\Compile\source\cef  
-------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat clone https://bitb  
ucket.org/chromiumembedded/cef.git D:\Develop\CEF3\Compile\source\cef" in "D:\De  
velop\CEF3\Compile\source"...  
Cloning into ‘D:\Develop\CEF3\Compile\source\cef‘...  
remote: Counting objects: 32815, done.  
remote: Compressing objects: 100% (8915/8915), done.  
remote: Total 32815 (delta 27309), reused 28831 (delta 23803)  
Receiving objects: 100% (32815/32815), 9.83 MiB | 789.00 KiB/s, done.  
Resolving deltas: 100% (27309/27309), done.  
Checking connectivity... done.  
-------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat rev-parse HEAD" in  
 "D:\Develop\CEF3\Compile\source\cef"...  
-------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat rev-parse d6601771  
8b0f0d44da42b706c3c2aa5c0c103852" in "D:\Develop\CEF3\Compile\source\cef"...  
--> CEF Current Checkout: 6d7ee1e08439672050c2c5bd022fbcc2e79770d4  
--> CEF Desired Checkout: d66017718b0f0d44da42b706c3c2aa5c0c103852 (d66017718b0f  
0d44da42b706c3c2aa5c0c103852)  
-------- Running "D:\Develop\CEF3\Compile\depot_tools\git.bat checkout d66017718  
b0f0d44da42b706c3c2aa5c0c103852" in "D:\Develop\CEF3\Compile\source\cef"...  
Checking out files: 100% (1049/1049), done.  
Note: checking out ‘d66017718b0f0d44da42b706c3c2aa5c0c103852‘.  
  
You are in ‘detached HEAD‘ state. You can look around, make experimental  
changes and commit them, and you can discard any commits you make in this  
state without impacting any branches by performing another checkout.  
  
If you want to create a new branch to retain commits you create, you may  
do so (now or later) by using -b with the checkout command again. Example:  
  
  git checkout -b new_branch_name  
  
HEAD is now at d660177... Update to Chromium version 43.0.2357.130  
--> CEF Output Directory: D:\Develop\CEF3\Compile\source\out_2357  
--> Creating directory D:\Develop\CEF3\Compile\source\chromium  
--> Writing file: D:\Develop\CEF3\Compile\source\chromium\.gclient  
-------- Running "gclient sync --nohooks --with_branch_heads --jobs 16" in "D:\D  
evelop\CEF3\Compile\source\chromium"...  
Cannot rebase: You have unstaged changes.  
Please commit or stash them.  
Failed to update depot_tools.  
  
[0:01:00] Still working on:  
[0:01:00]   src  
  
[0:01:14] Still working on:  
[0:01:14]   src  
  
[0:01:25] Still working on:  
[0:01:25]   src  
  
[0:01:35] Still working on:  
[0:01:35]   src  
  
[0:01:45] Still working on:  
 
cipd.ps1错误
遇到如下红字的错误可以忽略
 
[plain] view plain copy
 
The term ‘git‘ is not recognized as the name of a cmdlet, function, script file  
, or operable program. Check the spelling of the name, or if a path was include  
d, verify that the path is correct and try again.  
At C:\src\depot_tools\cipd.ps1:31 char:25  
+ $depot_tools_version = & <<<< git -C $myPath rev-parse HEAD 2>&1  
+ CategoryInfo : ObjectNotFound: (git:String) [], CommandNotFound  
Exception  
+ FullyQualifiedErrorId : CommandNotFoundException  
 
获取代码及依赖工具
报错
 
[plain] view plain copy
 
0> Failed to fetch file gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe  
6 for src/buildtools/win/gn.exe, skipping. [Err: Traceback (most recent call las  
t):  
  File "c:\src\depot_tools\gsutil.py", line 160, in <module>  
    sys.exit(main())  
  File "c:\src\depot_tools\gsutil.py", line 157, in main  
    clean=args.clean)  
  File "c:\src\depot_tools\gsutil.py", line 125, in run_gsutil  
    gsutil_bin = ensure_gsutil(force_version, target, clean)  
  File "c:\src\depot_tools\gsutil.py", line 107, in ensure_gsutil  
    target_zip_filename = download_gsutil(version, instance_dir)  
  File "c:\src\depot_tools\gsutil.py", line 62, in download_gsutil  
    u = urllib2.urlopen(url)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 127, in urlopen  
    return _opener.open(url, data, timeout)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 404, in open  
    response = self._open(req, data)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 422, in _open  
    ‘_open‘, req)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 382, in _call_cha  
in  
    result = func(*args)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1222, in https_op  
en  
    return self.do_open(httplib.HTTPSConnection, req)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1184, in do_open  
    raise URLError(err)  
urllib2.URLError: <urlopen error [Errno 10060] A connection attempt failed becau  
se the connected party did not properly respond after a period of time, or estab  
lished connection failed because connected host has failed to respond>  
]  
Downloading 1 files took 21.630000 second(s)  
NOTICE: You have PROXY values set in your environment, but gsutil in depot_tools  
 does not (yet) obey them.  
Also, --no_auth prevents the normal BOTO_CONFIG environment variable from being  
used.  
To use a proxy in this situation, please supply those settings in a .boto file p  
ointed to by the NO_AUTH_BOTO_CONFIG environment var.  
Failed to fetch file gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe6 f  
or src/buildtools/win/gn.exe. [Err: Traceback (most recent call last):  
  File "c:\src\depot_tools\gsutil.py", line 160, in <module>  
    sys.exit(main())  
  File "c:\src\depot_tools\gsutil.py", line 157, in main  
    clean=args.clean)  
  File "c:\src\depot_tools\gsutil.py", line 125, in run_gsutil  
    gsutil_bin = ensure_gsutil(force_version, target, clean)  
  File "c:\src\depot_tools\gsutil.py", line 107, in ensure_gsutil  
    target_zip_filename = download_gsutil(version, instance_dir)  
  File "c:\src\depot_tools\gsutil.py", line 62, in download_gsutil  
    u = urllib2.urlopen(url)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 127, in urlopen  
    return _opener.open(url, data, timeout)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 404, in open  
    response = self._open(req, data)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 422, in _open  
    ‘_open‘, req)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 382, in _call_cha  
in  
    result = func(*args)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1222, in https_op  
en  
    return self.do_open(httplib.HTTPSConnection, req)  
  File "c:\src\depot_tools\python276_bin\lib\urllib2.py", line 1184, in do_open  
    raise URLError(err)  
urllib2.URLError: <urlopen error [Errno 10060] A connection attempt failed becau  
se the connected party did not properly respond after a period of time, or estab  
lished connection failed because connected host has failed to respond>  
]  
Error: Command ‘download_from_google_storage --no_resume --platform=win32 --no_a  
uth --bucket chromium-gn -s src/buildtools/win/gn.exe.sha1‘ returned non-zero ex  
it status 1 in c:\src\source\chromium  
Hook ‘download_from_google_storage --no_resume --platform=win32 --no_auth --buck  
et chromium-gn -s src/buildtools/win/gn.exe.sha1‘ took 23.11 secs  
Traceback (most recent call last):  
  File "automate-git.py", line 879, in <module>  
    chromium_dir, depot_tools_dir)  
  File "automate-git.py", line 55, in run  
    shell=(sys.platform == ‘win32‘))  
  File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
call  
    raise CalledProcessError(retcode, cmd)  
subprocess.CalledProcessError: Command ‘[‘gclient‘, ‘sync‘, ‘--with_branch_heads  
‘, ‘--jobs‘, ‘16‘]‘ returned non-zero exit status 2  
 
 
批处理脚本RunDownloads.py.bat
注意代理https不是http
 
[plain] view plain copy
 
@rem When Run Command [gclient runhooks]  
  
  
@rem Download_Failed===========================  
@rem download_from_google_storage --no_resume --platform=win32 --directory --recursive --no_auth --num_threads=16 --bucket chromium-apache-win32  --boto=E:\_ChromiumDev\gclient_chromium_src\.boto src/third_party/apache-win32   
@rem Download_Failed===========================  
  
set <span style="color:#FF0000;">https</span>_proxy=//cn-proxy.jp.oracle.com:80  
call RunWget.bat  gs://chromium-gn/14b37907020b299b5c6bfae1d7fed7d7a92e4fe6 src/buildtools/win/gn.exe  
  
  
  
cmd  
 
RunWget.bat
需要设置wget的环境变量路径Path,
SRC_DIR要根据自己的代码路径设置
 
[plain] view plain copy
 
@echo off  
if "%1"=="" goto error  
  
@rem ##########  
@rem 2> File gs://chromium-apache-win32/11ba0c1941b9c46ad279f33c2db3e3c628197ae8 for  
@rem src/third_party/apache-win32\bin\httpd.exe does not exist, skipping.  
@rem 3> File gs://chromium-apache-win32/199cb003a5a40db260f29128ae630f298aaf7702 for  
@rem src/third_party/apache-win32\bin\libapriconv-1.dll does not exist, skipping.  
@rem ##########  
set SRC_DIR=D:\Work_area\CEF3\source\chromium  
  
@rem set param1=gs://chromium-apache-win32/11ba0c1941b9c46ad279f33c2db3e3c628197ae8  
@rem set param2=src/third_party/apache-win32\bin\httpd.exe  
set param1=%1  
set param2=%2  
echo [INFO][%time%] ==========Begin==================  
echo [INFO][%time%] gs_url=%param1%  
set baseurl=https://storage.googleapis.com/  
set baseurl=%baseurl%%param1:~5%  
echo [INFO][%time%] httpBaseUrl=%baseurl%  
  
  
:StartDownload  
@rem 进行一次 文件是否 覆盖的用户交互  
pushd .  
cd %SRC_DIR%  
set cover  
if "%cover%"=="" set cover=2  
if exist %param2% (  
    if %cover%==2 (  
        set /p cover=文件已存在,是否覆盖?[0=不覆盖 1=覆盖]:  
    )  
)  
popd  
if not exist %param2% (  
    goto :continue  
)  
if %cover%==1 goto :continue  
echo [INFO][%time%]================END================  
goto :eof  
  
:continue  
pushd .  
cd %SRC_DIR%  
wget --no-check-certificate %baseurl% -O %param2%  
echo [%time%][SUCCESS] Dwonloads to url:%param2%  success!!!  
echo [INFO][%time%]===============END=================  
popd  
goto :eof  
  
:error  
echo Help:  
echo     %0 [gs://name/hash] [saveToPath]  
pause  
 
各个文件的相对位置结构
 
开始编译
错误skedge.cpp(231) warning C4334
 
[plain] view plain copy
 
[4453/15559] CXX obj\third_party\skia\src\core\skia_library.SkEdge.obj  
FAILED: obj/third_party/skia/src/core/skia_library.SkEdge.obj  
ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
dio 14.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\ski  
a\src\core\skia_library.SkEdge.obj.rsp /c ..\..\third_party\skia\src\core\SkEdge  
.cpp /Foobj\third_party\skia\src\core\skia_library.SkEdge.obj /Fdobj\skia\skia_l  
ibrary.cc.pdb  
c:\src\source\chromium\src\third_party\skia\src\core\skedge.cpp(231): error C222  
0: warning treated as error - no ‘object‘ file generated  
c:\src\source\chromium\src\third_party\skia\src\core\skedge.cpp(231): warning C4  
334: ‘<<‘: result of 32-bit shift implicitly converted to 64 bits (was 64-bit sh  
ift intended?)  
[4458/15559] CXX obj\third_party\skia\src\core\skia_library.SkFlattenable.obj  
ninja: build stopped: subcommand failed.  
Traceback (most recent call last):  
  File "automate-git.py", line 980, in <module>  
    if options.buildlogfile else None)  
  File "automate-git.py", line 55, in run  
    shell=(sys.platform == ‘win32‘))  
  File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
call  
    raise CalledProcessError(retcode, cmd)  
subprocess.CalledProcessError: Command ‘[‘ninja‘, ‘-C‘, ‘out\\Debug‘, ‘cefclient  
‘]‘ returned non-zero exit status 1  
 
 
解决
在文件source\chromium\src\skia\skia_common.gypi
\source\chromium\src\google_apis\google_apis.gyp
 
[plain] view plain copy
 
# We would prefer this to be direct_dependent_settings,  
# however we currently have no means to enforce that direct dependents  
# re-export if they include Skia headers in their public headers.  
‘all_dependent_settings‘: {  
  ‘include_dirs‘: [  
    ‘..‘,  
    ‘config‘,  
  ],  
},  
  
‘msvs_disabled_warnings‘: [4244, 4267,<span style="color:#FF6666;"><strong> <span style="color:#FF0000;">4334</span></strong></span>, 4341, 4345, 4390, 4554, 4748, 4800],  
 
error C2679
解决:gl_bindings_skia_in_process.cc和 gl_bindings_skia_in_process.hh已经死代码了。
ui/gl/BUILD.gn和gl.gyp去除这两个引用详见https://codereview.chromium.org/1673323002
 
[html] view plain copy
 
FAILED: obj/ui/gl/gl.gl_bindings_skia_in_process.obj  
ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
dio 14.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\ui\gl\gl.gl_bin  
dings_skia_in_process.obj.rsp /c ..\..\ui\gl\gl_bindings_skia_in_process.cc /Foo  
bj\ui\gl\gl.gl_bindings_skia_in_process.obj /Fdobj\ui\gl\gl.cc.pdb  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(860): error C267  
9: binary ‘=‘: no operator found which takes a right-hand operand of type ‘overl  
oaded-function‘ (or there is no acceptable conversion)  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: could be ‘GrGLInterface::GLPtr<GrGLBufferDataProc> &GrGLInterface::GLPtr<  
GrGLBufferDataProc>::operator =(GrGLInterface::GLPtr<GrGLBufferDataProc> &&)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: or       ‘GrGLInterface::GLPtr<GrGLBufferDataProc> &GrGLInterface::GLPtr<  
GrGLBufferDataProc>::operator =(const GrGLInterface::GLPtr<GrGLBufferDataProc> &  
)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
 note: or       ‘GrGLInterface::GLPtr<GrGLBufferDataProc> GrGLInterface::GLPtr<G  
rGLBufferDataProc>::operator =(FNPTR_TYPE)‘  
        with  
        [  
            FNPTR_TYPE=GrGLBufferDataProc  
        ]  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(860): note: whil  
e trying to match the argument list ‘(GrGLInterface::GLPtr<GrGLBufferDataProc>,  
overloaded-function)‘  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(861): error C267  
9: binary ‘=‘: no operator found which takes a right-hand operand of type ‘overl  
oaded-function‘ (or there is no acceptable conversion)  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: could be ‘GrGLInterface::GLPtr<GrGLBufferSubDataProc> &GrGLInterface::GLP  
tr<GrGLBufferSubDataProc>::operator =(GrGLInterface::GLPtr<GrGLBufferSubDataProc  
> &&)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: or       ‘GrGLInterface::GLPtr<GrGLBufferSubDataProc> &GrGLInterface::GLP  
tr<GrGLBufferSubDataProc>::operator =(const GrGLInterface::GLPtr<GrGLBufferSubDa  
taProc> &)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
 note: or       ‘GrGLInterface::GLPtr<GrGLBufferSubDataProc> GrGLInterface::GLPt  
r<GrGLBufferSubDataProc>::operator =(FNPTR_TYPE)‘  
        with  
        [  
            FNPTR_TYPE=GrGLBufferSubDataProc  
        ]  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(861): note: whil  
e trying to match the argument list ‘(GrGLInterface::GLPtr<GrGLBufferSubDataProc  
>, overloaded-function)‘  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(891): error C267  
9: binary ‘=‘: no operator found which takes a right-hand operand of type ‘overl  
oaded-function‘ (or there is no acceptable conversion)  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: could be ‘GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> &GrGLInter  
face::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(GrGLInterface::GLPtr<GrG  
LFlushMappedBufferRangeProc> &&)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: or       ‘GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> &GrGLInter  
face::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(const GrGLInterface::GLP  
tr<GrGLFlushMappedBufferRangeProc> &)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
 note: or       ‘GrGLInterface::GLPtr<GrGLFlushMappedBufferRangeProc> GrGLInterf  
ace::GLPtr<GrGLFlushMappedBufferRangeProc>::operator =(FNPTR_TYPE)‘  
        with  
        [  
            FNPTR_TYPE=GrGLFlushMappedBufferRangeProc  
        ]  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(891): note: whil  
e trying to match the argument list ‘(GrGLInterface::GLPtr<GrGLFlushMappedBuffer  
RangeProc>, overloaded-function)‘  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(920): error C267  
9: binary ‘=‘: no operator found which takes a right-hand operand of type ‘overl  
oaded-function‘ (or there is no acceptable conversion)  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: could be ‘GrGLInterface::GLPtr<GrGLMapBufferRangeProc> &GrGLInterface::GL  
Ptr<GrGLMapBufferRangeProc>::operator =(GrGLInterface::GLPtr<GrGLMapBufferRangeP  
roc> &&)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(116):  
 note: or       ‘GrGLInterface::GLPtr<GrGLMapBufferRangeProc> &GrGLInterface::GL  
Ptr<GrGLMapBufferRangeProc>::operator =(const GrGLInterface::GLPtr<GrGLMapBuffer  
RangeProc> &)‘  
c:\src\source\chromium\src\third_party\skia\include\gpu\gl\grglinterface.h(112):  
 note: or       ‘GrGLInterface::GLPtr<GrGLMapBufferRangeProc> GrGLInterface::GLP  
tr<GrGLMapBufferRangeProc>::operator =(FNPTR_TYPE)‘  
        with  
        [  
            FNPTR_TYPE=GrGLMapBufferRangeProc  
        ]  
c:\src\source\chromium\src\ui\gl\gl_bindings_skia_in_process.cc(920): note: whil  
e trying to match the argument list ‘(GrGLInterface::GLPtr<GrGLMapBufferRangePro  
c>, overloaded-function)‘  
[757/7473] CXX obj\ui\gl\gl.gl_bindings_autogen_gl.obj  
ninja: build stopped: subcommand failed.  
Traceback (most recent call last):  
  File "automate-git.py", line 980, in <module>  
    if options.buildlogfile else None)  
  File "automate-git.py", line 55, in run  
    shell=(sys.platform == ‘win32‘))  
  File "C:\src\depot_tools\python276_bin\lib\subprocess.py", line 540, in check_  
call  
    raise CalledProcessError(retcode, cmd)  
subprocess.CalledProcessError: Command ‘[‘ninja‘, ‘-C‘, ‘out\\Debug‘, ‘cefclient  
‘]‘ returned non-zero exit status 1  
 
error C4430
#解决egl语法错误#修改h:\ws\source\chromium\src\third_party\swiftshader\include\egl\eglext.h#在62行后加入typedef EGLAttribKHR EGLAttrib; 
[plain] view plain copy
 
FAILED: obj/ui/gl/gl.egl_util.obj  
ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Stu  
dio 14.0\VC\bin\amd64_x86\cl.exe"    

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言VC/MFC频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程