Skip to content

redblobgames/2002-rust-chat-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2002-rust-chat-server

http://unmaintained.tech/badge.svg

I am learning Rust+Wasm and wanted to set up a way to build three outputs on my Mac from the same Cargo file:

  1. Wasm client
  2. Mac server
  3. Linux server

I don’t think this is the best way to do it but I am sharing what I did.

Installing Rust

brew install rustup
rustup-init
# add $HOME/.cargo/bin to $PATH

rustup target add rust-src
cargo install --version 2.0.13 racer

Install the Web Assembly tools:

rustup target add wasm32-unknown-unknown
brew install wabt binaryen
cargo install wasm-snip
cargo install wasm-gc
cargo install wasm-bindgen-cli

Install the Linux cross compiler:

rustup target add x86_64-unknown-linux-musl
brew install FiloSottile/musl-cross/musl-cross

To make the cross-compiler work, the project’s .cargo/config should contain:

[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"

Running

Build the code:

make

Run the server:

make run-server

Then load build/embed.html into your browser.

Reading

About

Learning Rust, with Mac+Linux+Wasm outputs, websockets, threads

Resources

License

Stars

Watchers

Forks