1234567891011121314151617181920212223242526 |
- #/bin/sh -x
- echo "tested with clang-7"
- clang --version
- clang --target=wasm32 --no-standard-libraries -Wl,--export-all -Wl,--no-entry -o add.wasm add.c
- echo "adding memory support with -Wl,--import-memory for lenstr.c"
- clang --target=wasm32 --no-standard-libraries -Wl,--export-all -Wl,--import-memory -Wl,--no-entry -o lenstr.wasm lenstr.c
- exit 0
- on debian with clang version 7, lld-7 as separate package installed
- missing link to /usr/bin/ldd added to /usr/bin/ldd-7
- The options passed to clang are:
- --target=wasm32 Set the build target to wasm.
- --no-standard-libraries Do not use libc (more on this later).
- -Wl,--export-all Export all symbols (i.e., add) from the compiled wasm file so that they can be used from JavaScript.
- -Wl,--no-entry Don't check for a main function.
- -o Set the output destination.
- Options preceded by -Wl, are passed from the LLVM compiler to the linker.
- The webserver to use is:
- pythom -m SimpleHTTPServer
- Then the page is on localhost at port 8000 and in console log file is "the answer is 3"
|