Lien : https://github.com/diekmann/wasm-fizzbuzz/tree/main/doom
Distribution de travail : Lubuntu 18.04 LTS
Lien : https://ubunlog.com/en/rust-programming-language-ubuntu/
util01@station01:~$ curl https://sh.rustup.rs -sSf | sh
...
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
...
util01@station01:~$ source $HOME/.cargo/env
util01@station01:~$ sudo apt-get install clang-10
util01@station01:~$ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 100
util01@station01:~$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100
util01@station01:~$ sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-10 100
util01@station01:~$ sudo update-alternatives --install /usr/bin/llc llc /usr/bin/llc-10 100
util01@station66:~$ clang --version
clang version 10.0.0-4ubuntu1~18.04.2
util01@station66:~$ llc --version
LLVM (http://llvm.org/):
LLVM version 10.0.0
...
wasm32 - WebAssembly 32-bit
wasm64 - WebAssembly 64-bit
...
util01@station01:~$ mkdir -p JEUX/DOOMWASM
util01@station01:~$ cd JEUX/DOOMWASM/
util01@station01:~/JEUX/DOOMWASM$
util01@station01:~/JEUX/DOOMWASM$ git clone https://github.com/WebAssembly/binaryen.git
util01@station01:~/JEUX/DOOMWASM$ cd binaryen/
util01@station01:~/JEUX/DOOMWASM/binaryen$
util01@station01:~/JEUX/DOOMWASM/binaryen$ cmake .
util01@station01:~/JEUX/DOOMWASM/binaryen$ make
util01@station01:~/JEUX/DOOMWASM/binaryen$ sudo make install
util01@station01:~/JEUX/DOOMWASM/binaryen$ cd ..
util01@station01:~/JEUX/DOOMWASM$
util01@station01:~/JEUX/DOOMWASM$ git clone https://github.com/diekmann/wasm-fizzbuzz.git
util01@station01:~/JEUX/DOOMWASM$ cd wasm-fizzbuzz/doom/
util01@station01:~/JEUX/DOOMWASM/wasm-fizzbuzz/doom$
util01@station01:~$ rustup target add wasm32-unknown-unknown
util01@station01:~/JEUX/DOOMWASM/wasm-fizzbuzz/doom$ make
cargo build --release
Compiling lazy_static v1.4.0
Compiling doom v0.1.0 (/home/util01/JEUX/DOOMWASM/wasm-fizzbuzz/doom)
...
Finished release [optimized] target(s) in 8.61s
# As log as wasm-ld does not look like it supports LTO for C/Rust cross-language LTO, binaryen is the best we have.
# TODO: use https://doc.rust-lang.org/rustc/linker-plugin-lto.html once it works for wasm.
wasm-opt -O3 -o doom.wasm target/wasm32-unknown-unknown/release/doom.wasm
Ouvrir :
/etc/mime.types
Chercher :
application/vemmi
Ajouter après :
application/wasm wasm
util01@station66:~/JEUX/DOOMWASM/wasm-fizzbuzz/doom$ make run_wasm
python3 -m http.server --bind 127.0.0.1
Serving HTTP on 127.0.0.1 port 8000 (http://127.0.0.1:8000/) ...
127.0.0.1 - - [18/Jul/2021 02:36:11] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [18/Jul/2021 02:36:11] "GET /main.js HTTP/1.1" 200 -
127.0.0.1 - - [18/Jul/2021 02:36:11] "GET /doom.wasm HTTP/1.1" 200 -
127.0.0.1 - - [18/Jul/2021 02:36:11] code 404, message File not found
127.0.0.1 - - [18/Jul/2021 02:36:11] "GET /favicon.ico HTTP/1.1" 404 -
Sous Firefox :
Adresse vers le jeu : https://projet.hacktech.dev/doom-wasm
doom1.wad doom.wasm index.html main.js
Liens :
https://community.ovh.com/t/ovh-et-webassembly/25455
https://www.milanlaslop.dev/post/2020-01-03-webassembly-file-sending-correct-content-type/
Solution :
Créer :
.htaccess
Ajouter :
AddType application/wasm .wasm