mac 安装emsdk记录

586 阅读1分钟

前言:js需要使用webassembly的功能,遇到了bug,为方便调试,需要安装emcc来编译c++文件

一、下载安装emsdk

# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk
# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

其中./emsdk install latest可能会出错:

Error: unable to get local issuer certificate 因为该脚本会请求下载https路径node,无法ssl证书错误

解决方法: 打开emsdk.py,

import ssl
context = ssl._create_unverified_context()

# 在urlopen调用的地方加上context参数
urlopen(url, context=context)

这样就不会校验ssl证书了

执行完以上步骤,emsdk已经安装完

参考:

developer.mozilla.org/en-US/docs/… blog.csdn.net/weixin_4265…