ubuntu,Emscripten 安装指南
时间: 2024-07-21 10:01:32 浏览: 195
Ubuntu是一个流行的开源Linux发行版,以其易用性和广泛的软件支持而闻名。要在Ubuntu上安装Emscripten(前称WebAssembly工具链),你可以按照以下步骤操作:
1. **更新系统**:
```sh
sudo apt update
sudo apt upgrade
```
2. **安装必要的依赖**:
```
sudo apt install build-essential git curl zlib1g-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libssl-dev python3-dev tk-dev libffi-dev
```
3. **下载并解压Emscripten源码**:
```sh
mkdir emscripten
cd emscripten
curl https://github.com/emscripten-core/emscripten/releases/download/emsdk-portable/emsdk.zip -o emsdk.zip
unzip emsdk.zip
rm emsdk.zip
```
4. **配置和初始化EmSDK**:
```
source ./emsdk_env.sh
emsdk install latest
emsdk activate latest
```
5. **设置环境变量**:
将以下行添加到~/.bashrc 或者 ~/.zshrc文件中,然后运行`source ~/.bashrc`或`source ~/.zshrc`来激活它们:
```bash
export EMCC=$EMSDK_ROOT/emsdk/upstream/emscripten/emcc
export PATH=$PATH:$EMSDK_ROOT/emsdk/bin
```
6. **测试安装**:
运行`em++ --version`来确认Emscripten已成功安装。
阅读全文