반응형
WebAssembly를 개발 하려면 Emscripten 설치 & 환경설정이 필요하다.
우선 아래와 같이 소스코드를 받는다.
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git
# Enter that directory
cd emsdk
설치를 시작한다.
% ./emsdk install latest
Installing SDK 'sdk-releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit'..
Installing tool 'node-12.18.1-64bit'..
Downloading: /Users/?????/emsdk/zips/node-v12.18.1-darwin-x64.tar.gz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v12.18.1-darwin-x64.tar.gz, 20873670 Bytes
Unpacking '/Users/?????/emsdk/zips/node-v12.18.1-darwin-x64.tar.gz' to '/Users/?????/emsdk/node/12.18.1_64bit'
Done installing tool 'node-12.18.1-64bit'.
Installing tool 'python-3.7.4-2-64bit'..
Downloading: /Users/?????/emsdk/zips/python-3.7.4-2-macos.tar.gz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/python-3.7.4-2-macos.tar.gz, 25365593 Bytes
Unpacking '/Users/?????/emsdk/zips/python-3.7.4-2-macos.tar.gz' to '/Users/?????/emsdk/python/3.7.4-2_64bit'
Done installing tool 'python-3.7.4-2-64bit'.
Installing tool 'releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit'..
Downloading: /Users/?????/emsdk/zips/dcf819a7821f8db0c8f15ac336fea8960ec204f5-wasm-binaries.tbz2 from https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/dcf819a7821f8db0c8f15ac336fea8960ec204f5/wasm-binaries.tbz2, 240930566 Bytes
Unpacking '/Users/?????/emsdk/zips/dcf819a7821f8db0c8f15ac336fea8960ec204f5-wasm-binaries.tbz2' to '/Users/?????/emsdk/upstream'
Done installing tool 'releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit'.
Running post-install step: npm ci ...
Running post-install step: npm install google-closure-compiler-osx
Done running: npm ci
Done installing SDK 'sdk-releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit'.
설치가 완료 되었으면 환경설정한다.
% ./emsdk activate latest
% source ./emsdk_env.sh
환경설정도 마무리되었다.
@ 마지막으로 간단하게 테스트를 해본다.
% mkdir TestServer
% cd TestServer
% touch hellow.c
% vi hellow.c
#include <stdio.h>
int main() {
printf("hello, world!\n");
return 0;
}
[저장명령어 : wq!]
% emcc hellow.c -O3 -o hellow.html
% python -m http.server 8000
브라우저에서 아래 링크 실행
http://localhost:8000/hellow.html
완료
반응형