Advertisement

PPAPI+VS2013开发(1):环境配置

阅读量:

说明:本文在其他博主博客上进行修改实践操作并撰写,在此谨向原作者表示衷心的感谢:<>

1.准备

Native Client SDK可通过访问 <https://developer.chrome.com natives client sdk download> 获取

Python 2.7,确保 Python 可执行文件在 PATH 变量中,Python 3.x 还不支持。

安装VS2013,英文语音包。

以上资源我已打包上传:<>

科学上网,嘿嘿嘿

2.安装 SDK

首先获取Native Client SDK并解压nacl_sdk.zip文件。解压完成后并以管理员权限启动cmd,在cmd窗口输入cd nacl_sdk启动命令,并确保目录名称不含中文字符

输入:

复制代码
 > cd nacl_sdk

    
  
    
 > naclsdk list
    
    
    
    
    bash

输出:

复制代码
 Bundles:

    
  
    
 I: installed
    
  
    
 *: update available
    
  
    
  
    
  
    
 I  sdk_tools (stable)
    
  
    
 I  vs_addin (dev)
    
  
    
 pepper_47 (post_stable)
    
  
    
 I  pepper_49 (stable)
    
  
    
 pepper_50 (beta)
    
  
    
 pepper_55 (beta)
    
  
    
 pepper_56 (dev)
    
  
    
 pepper_canary (canary)
    
    
    
    
    bash
![](https://ad.itadn.com/c/weblog/blog-img/images/2025-07-12/BxVfbRQ5Ee4mctF2ypjKYSnAdvlU.png)

可能错误:

复制代码
 third_party.fancy_urllib.InvalidCertificateException: Host storage.googleapis.com returned an invalid certificate ([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)):

    
  
    
 To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
    
    
    
    
    bash

解决方案:

这是由于 HTTPS 证书引起的问题,我用的解决办法是将 HTTPS 替换为 HTTP。

打开 nacl_sdk\sdk_tools 目录下的 download.py 文件,修改 UrlOpen 方法为:

复制代码
 def UrlOpen(url):

    
  
    
     request = fancy_urllib.FancyRequest(url.replace("https://", "http://"))
    
  
    
     ca_certs = os.path.join(SCRIPT_DIR, 'cacerts.txt')
    
  
    
     request.set_ssl_info(ca_certs=ca_certs)
    
  
    
     #url_opener = urllib2.build_opener(
    
  
    
     # fancy_urllib.FancyProxyHandler(),
    
  
    
     # fancy_urllib.FancyRedirectHandler(),
    
  
    
     # fancy_urllib.FancyHTTPSHandler())
    
  
    
     url_opener = urllib2.build_opener()
    
  
    
     url_opener.addheaders = [('User-agent', 'Mozilla/5.0')]
    
  
    
     return url_opener.open(request)
    
    
    
    
    python
    
    
![](https://ad.itadn.com/c/weblog/blog-img/images/2025-07-12/SCy8W0LMvgl2KwPAZxiQhm5X9B6z.png)

安装 vs_addin

安装完成后发现nacl_sdk缺少相应的_vs_addin配置文件,请使用命令naclsdk update进行配置文件的安装(在Windows 10系统上安装时,请确保已启用管理员权限)。

配置环境变量:“NACL_SDK_ROOT”: nacl_sdk (本文为 papper_49) 的路径

“CHROME_PATH”:谷歌浏览器exe路径

默认安装的 vs_addin 只支持 VS 2010 和 VS 2012,默认情况下只适用于这两个版本。在该文件夹内运行 install.py 和 create_ppapi_platform.py,并将其中的所有出现的 2013 替换回 20年份和 v8 替换回 v9 版本。

F:\workDir\PPAPI\nacl_sdk\vs_addin>install.bat

输出:

复制代码
 Set up configuration to enable Pepper development with Visual Studio?

    
  
    
 ((Yes)) - I want to create and copy relevant files into a Pepper subdirectory
    
  
    
 ((No)) - I am not interested or will set up the configuration later
    
  
    
 Continue? ((Yes))/((No))
    
  
    
 y
    
  
    
 Confirmed installer will include PPAPI platform.
    
  
    
  
    
  
    
  
    
  
    
 Installing MSBuild components...
    
  
    
 NaCl common resources installed.
    
  
    
 NaCl32 platform installed.
    
  
    
 NaCl64 platform installed.
    
  
    
 NaClARM platform installed.
    
  
    
 PNaCl platform installed.
    
  
    
 PPAPI platform installed.
    
  
    
  
    
  
    
  
    
  
    
 Installing Add-in: C:\Users\wangenxiang\My Documents\Visual Studio 2013
    
  
    
 Add-in installed.
    
  
    
  
    
  
    
  
    
  
    
 Installation complete!
    
  
    
  
    
  
    
  
    
  
    
 请按任意键继续. . .
    
    
    
    
    bash
![](https://ad.itadn.com/c/weblog/blog-img/images/2025-07-12/OqVX38a0GoWN7QKIlJ4edwf2rPYx.png)

设置 Chrome

设置 Chrome 以启用 Native Client 支持:

在 Chrome 浏览器地址栏中输入"chrome://flags"

将 #enable-nacl、#enable-nacl-debug、及 #allow-nacl-socket-api 设为启用

3.在 Chrome 浏览器地址栏中输入"chrome://nacl",检查 nacl 是否启用成功

表示环境配置完成。

全部评论 (0)

还没有任何评论哟~