googlecodelabs / web-assembly-introduction

Introduction to Web Assembly
Apache License 2.0
27 stars 9 forks source link

The instructions for installation of emscripten are out of date #22

Open jaime-varela opened 4 years ago

jaime-varela commented 4 years ago

The commands on the intro are out of date:

https://emscripten.org/docs/getting_started/downloads.html

kymwei commented 4 years ago

Fetch the latest registry of available tools.

./emsdk update

Download and install the latest SDK tools.

./emsdk install latest

Set up the compiler configuration to point to the "latest" SDK.

./emsdk activate latest

harishdhawan commented 4 years ago

It still does not work.. I get following error.. Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #0 module="env" function="emscripten_resize_heap" error: function import requires a callable

joshuaaguilar20 commented 4 years ago

@harishdhawan here is what worked for me. The above comments along with a few extra steps.

If you installed it via CLI and have a get client installed follow this.

# if this was just pulled should be the most up to date 
 git clone https://github.com/juj/emsdk.git
 cd emsdk
#instead of ./emsdk update
git pull 
./emsdk install latest

After that you should get the following:

#run the command output in your console which should look like the below with a  different path
source "/Users/jr/jProjects/webAssemby/emsdk/emsdk_env.sh"
#Dont forget to add it to bash_profile if on mac or linux (not sure about windows haha)
echo 'source "/Users/jaguilar/jProjects/webAssemby/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
#test install
 emcc
# worked :) 
**shared:INFO: (Emscripten: Running sanity checks)
emcc: error: no input files**

Then When you go to build the game of life the settings command is wrong as well

#Once emcc  is installed download the code repo (NOT the SDK)  : 
git clone https://github.com/googlecodelabs/web-assembly-introduction.git
cd lyff

#command that was wrong in docs, Now correct. takes C input function and converts to JS so cool!
emcc   -s WASM=1 -s EXPORTED_FUNCTIONS="['_board_init','_board_ref','_board_step']"   -o output.js lyff.c 

The wild card *.c in the docs would be awesome if it could scan all the C files. Did not work not sure if this was for the convention or not.