Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for compiling WebAssembly wasm32-unknown-unknown target #92

Merged
merged 65 commits into from
Mar 3, 2019

Conversation

iceiix
Copy link
Owner

@iceiix iceiix commented Jan 12, 2019

Another target besides Windows, Linux, Mac: add WebAssembly support, now that it is supported well by Rust. Reference: https://rustwasm.github.io/book/

@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown

fails in rustc-serialize:

error[E0046]: not all trait items implemented, missing: `encode`                                                                                                             
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1                                                          
     |                                                                                                                                                                       
853  |     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error>;                                                                                                  
     |     ---------------------------------------------------------------- `encode` from trait                                                                              
...                                                                                                                                                                          
1358 | impl Encodable for path::Path {                                                                                                                                       
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `encode` in implementation                                                                                                      
                                                                                                                                                                             
error[E0046]: not all trait items implemented, missing: `decode`                                                                                                             
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1382:1                                                          
     |                                                                                                                                                                       
904  |     fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error>;                                                                                                       
     |     ----------------------------------------------------------- `decode` from trait                                                                                   
...                                                                                                                                                                          
1382 | impl Decodable for path::PathBuf {                                                                                                                                    
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `decode` in implementation                                                                                                   
                                                                                                                                                                             
error: aborting due to 2 previous errors                                     

rustc-serialize is deprecated in favor of serde, who is still using it? Cargo.lock shows num 0.1, which is depended on by collision 0.18.0. num 0.2 fixes this, collision-rs in git has an update to num 0.2 not yet published: rustgd/collision-rs@e6cf494

Using git version until in a release: rustgd/collision-rs#106
Fixes wasm incompatibility in deprecated rustc-serialize crate:

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1
@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

Getting past the collision-rs/num/rustc-serialize incompatibility, there are now 243 errors, cannot find symbols, but they are all in:

registry/src/github.aaakk.us.kg-1ecc6299db9ec823/net2-0.2.33/src/ext.rs
registry/src/github.aaakk.us.kg-1ecc6299db9ec823/net2-0.2.33/src/socket.rs
registry/src/github.aaakk.us.kg-1ecc6299db9ec823/net2-0.2.33/src/tcp.rs
registry/src/github.aaakk.us.kg-1ecc6299db9ec823/net2-0.2.33/src/udp.rs
registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs

shared_library tries to use the dl module (dynamic linking?), and net2 a bunch of networking socket constants. net2 is used by hyper, used by reqwest for HTTP requests, and shared_library by glutin for caca. Networking will need to be rethought, but what about shared_library in glutin, has no one attempted to port glutin apps to the web?

error[E0433]: failed to resolve: use of undeclared type or module `dl`                                                                                                       
  --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:32:27                                                         
   |                                                                                                                                                                         
32 |         if let Err(str) = dl::check_for_errors_in(|| unsafe {                                                                                                           
   |                           ^^ use of undeclared type or module `dl`                                                                                                      
                                                                                                                                                                             
error[E0433]: failed to resolve: use of undeclared type or module `dl`                                                                                                       
  --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:33:13                                                         
   |                                                                                                                                                                         
33 |             dl::close(self.handle)                                                                                                                                      
   |             ^^ use of undeclared type or module `dl`                                                                                                                    
                                                                                                                                                                             
error[E0433]: failed to resolve: use of undeclared type or module `dl`                                                                                                       
  --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:68:9                                                          
   |                                                                                                                                                                         
68 |         dl::open(filename.map(|path| path.as_os_str()))                                                                                                                 
   |         ^^ use of undeclared type or module `dl`                                                                                                                        
                                                                                                                                                                             
error[E0433]: failed to resolve: use of undeclared type or module `dl`                                                                                                       
   --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:128:9                                                        
    |                                                                                                                                                                        
128 |         dl::check_for_errors_in(|| {                                                                                                                                   
    |         ^^ use of undeclared type or module `dl`                                                                                                                       
                                                                                                                                                                             
error[E0433]: failed to resolve: use of undeclared type or module `dl`                                                                                                       
   --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:129:17                                                       
    |                                                                                                                                                                        
129 |                 dl::symbol(self.handle as *mut libc::c_void, raw_string.as_ptr() as *const _)                                                                          
    |                 ^^ use of undeclared type or module `dl`                                                                                                               
                                                                                                                                                                             
error[E0412]: cannot find type `c_void` in module `libc`                                                                                                                     
   --> .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/shared_library-0.1.9/src/dynamic_library.rs:129:54                                                       
    |                                                                                                                                                                        
129 |                 dl::symbol(self.handle as *mut libc::c_void, raw_string.as_ptr() as *const _)                                                                          
    |                                                      ^^^^^^ not found in `libc`                                                                                        
help: possible candidates are found in other modules, you can import them into scope                                                                                         
    |                                                                                                                                                                        
17  | use std::ffi::c_void;                                                                                                                                                  
    |                                                                                                                                                                        
17  | use std::os::raw::c_void;                                                                                                                                              
    |                                           

@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

glutin seems to have at least some support for wasm: rust-windowing/glutin#36 [WIP] Support for emscripten. It uses emscripten, which suggests wasm32-unknown-emscripten target, instead of wasm32-unknown-unknown. How about building against that target? It fails but with surprisingly fewer errors:

$ cargo run --target wasm32-unknown-emscripten
   Compiling void v1.0.2                                                                                                                                                     
   Compiling nodrop v0.1.12                                                                                                                                                  
   Compiling libc v0.2.43                                                                                                                                                    
   Compiling stable_deref_trait v1.1.1                                                                                                                                       
   Compiling rand_core v0.2.1                                                                                                                                                
   Compiling crossbeam-utils v0.5.0                                                                                                                                          
   Compiling scopeguard v0.3.3                                                                                                                                               
   Compiling cfg-if v0.1.5                                                                                                                                                   
   Compiling byteorder v1.2.7                                                                                                                                                
   Compiling lazy_static v1.2.0                                                                                                                                              
   Compiling memoffset v0.2.1                                                                                                                                                
   Compiling lazycell v1.2.0                                                                                                                                                 
   Compiling futures v0.1.25                                                                                                                                                 
   Compiling slab v0.4.1                                                                                                                                                     
   Compiling foreign-types-shared v0.1.1                                                                                                                                     
   Compiling itoa v0.4.3                                                                                                                                                     
   Compiling matches v0.1.8                                                                                                                                                  
   Compiling fnv v1.0.6                                                                                                                                                      
   Compiling try-lock v0.2.2                                                                                                                                                 
   Compiling siphasher v0.2.3                                                                                                                                                
   Compiling unicode-normalization v0.1.7                                                                                                                                    
   Compiling indexmap v1.0.2                                                                                                                                                 
   Compiling string v0.1.1                                                                                                                                                   
   Compiling bitflags v1.0.4                                                                                                                                                 
   Compiling byte-tools v0.3.0                                                                                                                                               
   Compiling adler32 v1.0.3                                                                                                                                                  
   Compiling approx v0.1.1                                                                                                                                                   
   Compiling bit-vec v0.5.0                                                                                                                                                  
   Compiling percent-encoding v1.0.1                                                                                                                                         
   Compiling either v1.5.0                                                                                                                                                   
   Compiling openssl-probe v0.1.2                                                                                                                                            
   Compiling color_quant v1.0.1                                                                                                                                              
   Compiling dtoa v0.4.3                                                                                                                                                     
   Compiling lzw v0.10.0                                                                                                                                                     
   Compiling opaque-debug v0.2.1                                                                                                                                             
   Compiling scoped_threadpool v0.1.9                                                                                                                                        
   Compiling fake-simd v0.1.2                                                                                                                                                
   Compiling steven_shared v0.0.1 (steven/shared)                                                                                                    
   Compiling safe-transmute v0.10.1                                                                                                                                          
   Compiling podio v0.1.6                                                                                                                                                    
   Compiling hex v0.3.2                                                                                                                                                      
   Compiling num-traits v0.2.6                                                                                                                                               
   Compiling num-integer v0.1.39                                                                                                                                             
   Compiling xcb v0.8.2                                                                                                                                                      
   Compiling serde v1.0.84                                                                                                                                                   
   Compiling log v0.4.6                                                                                                                                                      
   Compiling crossbeam-utils v0.2.2                                                                                                                                          
   Compiling crossbeam-utils v0.6.3                                                                                                                                          
   Compiling arrayvec v0.4.7                                                                                                                                                 
   Compiling owning_ref v0.3.3                                                                                                                                               
   Compiling num-bigint v0.2.1                                                                                                                                               
   Compiling unreachable v1.0.0                                                                                                                                              
   Compiling typenum v1.10.0                                                                                                                                                 
   Compiling num-complex v0.2.1                                                                                                                                              
   Compiling foreign-types v0.3.2                                                                                                                                            
   Compiling num-iter v0.1.37                                                                                                                                                
   Compiling rayon-core v1.4.1                                                                                                                                               
   Compiling httparse v1.3.3                                                                                                                                                 
   Compiling unicode-bidi v0.3.4                                                                                                                                             
   Compiling num-rational v0.2.1                                                                                                                                             
   Compiling cgmath v0.16.1                                                                                                                                                  
   Compiling ryu v0.2.6                                                                                                                                                      
   Compiling base64 v0.10.0                                                                                                                                                  
   Compiling crc32fast v1.1.2                                                                                                                                                
   Compiling block-padding v0.1.2                                                                                                                                            
   Compiling encoding_rs v0.8.10                                                                                                                                             
   Compiling iovec v0.1.2                                                                                                                                                    
   Compiling rand v0.5.5                                                                                                                                                     
   Compiling net2 v0.2.33                                                                                                                                                    
   Compiling num_cpus v1.8.0                                                                                                                                                 
   Compiling rand v0.4.3                                                                                                                                                     
   Compiling time v0.1.40                                                                                                                                                    
   Compiling shared_library v0.1.9                                                                                                                                           
   Compiling deflate v0.7.19                                                                                                                                                 
   Compiling inflate v0.4.3                                                                                                                                                  
   Compiling steven_resources v0.1.0 (steven/resources)                                                                                              
   Compiling bit-set v0.5.0                                                                                                                                                  
   Compiling unicase v1.4.2                                                                                                                                                  
   Compiling unicase v2.2.0                                                                                                                                                  
   Compiling bzip2-sys v0.1.6                                                                                                                                                
   Compiling miniz-sys v0.1.11                                                                                                                                               
   Compiling gif v0.10.0                                                                                                                                                     
   Compiling winit v0.18.0                                                                                                                                                   
   Compiling openssl-sys v0.9.39                                                                                                                                             
   Compiling lock_api v0.1.4                                                                                                                                                 
   Compiling smallvec v0.6.5                                                                                                                                                 
error: failed to run custom build command for `xcb v0.8.2`                                                                                                                   
process didn't exit successfully: `steven/target/debug/build/xcb-6d64b017be0e5310/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to find build dependency python3: Os { code: 2, kind: NotFound, message: "No such file or directory" }', libcore/result.rs:1009:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed                    

xcb is X clipboard, used by x11-clipboard, used by rust-clipboard. HTML5 has clipboard APIs: https://www.w3.org/TR/clipboard-apis/ but may want to just #cfg it out. Interestingly, rust-clipboard compiles with cargo build --target wasm32-unknown-unknown only an unused err warning, but fails cargo build --target wasm32-unknown-emscripten with the xcb error.

@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

Next failure, error[E0432]: unresolved imports self::unix::Events, self::unix::Selector at registry/src/github.aaakk.us.kg-1ecc6299db9ec823/mio-0.6.16/src/sys/mod.rs:5:5. mio is used by tokio, tokio-reactor/tcp, which is used by hyper, which is used by reqwest. There is some interest in adding wasm32-unknown-unknown support to reqwest, having it use probably web_sys to access Web APIs like fetch, but it is a large change and not there yet. Even if it was, the web browser wouldn't be able to access the resources we want to. Possible to exclude dependencies in Cargo.toml with cfg?

@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

Now it compiles, with a few warnings but no errors: Finished dev [optimized + debuginfo] target(s) in 8m 20s

-rw-r--r-- 2 admin staff 6.9M Jan 12 13:56 target/wasm32-unknown-emscripten/debug/stevenarella.wasm

but does it run?

@iceiix
Copy link
Owner Author

iceiix commented Jan 12, 2019

https://rustwasm.github.io/book/game-of-life/hello-world.html shows how to setup the rust wasm binary with wasmpack

@iceiix iceiix changed the title wasm WebAssembly support Jan 13, 2019
@iceiix
Copy link
Owner Author

iceiix commented Jan 13, 2019

Followed the tutorial at https://rustwasm.github.io/book/game-of-life/hello-world.html but it uses pre-generated templates, creating a new project, will have to work through how to adopt this project to it. wasm-pack build fails with:

steven $ wasm-pack build
  
  [1/9] 🦀  Checking `rustc` version...
| [2/9] 🔧  Checking crate configuration...
crate-type must be cdylib to compile to wasm32-unknown-unknown. Add the following to your Cargo.toml file:

[lib]
crate-type = ["cdylib", "rlib"]

but its an application, not a library; adding that to Cargo.toml fails:

$ wasm-pack build
  
  [1/9] 🦀  Checking `rustc` version...
  [2/9] 🔧  Checking crate configuration...
  [3/9] 🎯  Adding WASM target...
  info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date
  [4/9] 🌀  Compiling to WASM...
  error: failed to parse manifest at `/Users/admin/games/rust/steven/Cargo.toml`
  
  Caused by:
|   can't find library `stevenarella`, rename file to `src/lib.rs` or specify lib.path
Compiling your crate to WebAssembly
Caused by: Process exited with exit code: 101: `cargo build` did not exit successfully.

stdout:

stderr:

error: failed to parse manifest at `/Users/admin/games/rust/steven/Cargo.toml`

Caused by:
  can't find library `stevenarella`, rename file to `src/lib.rs` or specify lib.path

What's the best way to support both a native application and wasm in the same project? There's also some setup steps at https://github.com/rustwasm/wasm-pack#-quickstart-guide

@iceiix
Copy link
Owner Author

iceiix commented Jan 13, 2019

Following the quick start guide, then wasm-pack build fails again compiling shared_library (a glutin dependency), undeclared module dl, same errors as earlier #92 (comment) when using wasm32-unknown-unknown. The wasm32-unknown-emscripten target gets further, would like to try using it instead, but the rustwasm book is not about emscripten.

https://www.reddit.com/r/rust/comments/7jpjoe/trying_to_build_httpsgithubcomkvarkwasmtriangle/ says there is https://github.com/lord/wargo to make running emscripten wasm rust apps easier, but the wasm32-unknown-unknown target is newer. wargo last modified 2017. https://www.reddit.com/r/rust/comments/7dqa8c/cant_figure_out_webassembly/ has some more insight, how Emscripten emulates a lot of features in a traditional runtime. steveklabnik1 says on https://www.reddit.com/r/rust/comments/87r4st/trying_to_set_up_the_webassembly_target/:

The emscripten target, while it has its uses, is much harder to get going with than the "unknown" target. Give https://www.hellorust.com/setup/wasm-target/ a try instead, IMO.

https://www.reddit.com/r/rust/comments/86o2al/cargo_not_compiling_web_asm_file/ is a similar situation to mine:

I'd like to, but I need emscripten for one of my dependencies (glutin). Is there a way to create an opengl context using wasm-unknown-unknown?

9 months ago:

I believe wasm32-unknown-emscripten is the old emscripten target, the new one you should use instead is wasm32-unknown-unknown.

I wish I could, but I have a dependency that requires emscripten for web assembly (glultin)

Emscripten is pretty much being slowly phased out so IMO you should try to move your dependencies to wasm ones :/

so what's a wasm-compatible dependency to replace glutin? Not married to glutin, already switched from sdl 2 (#35 iceiix/steven#35), can switch again if required.

@iceiix
Copy link
Owner Author

iceiix commented Jan 13, 2019

Progress: copying shell.html from https://github.com/kripken/emscripten/blob/incoming/src/shell.html, updating the script src, then serve through python -m SimpleHTTPServer visit http://localhost:8000/ in Chrome, it loads the wasm32-unknown-emscripten module!

screen shot 2019-01-13 at 11 59 42 am

but there is a panic in winit:

shell.html:1246 thread 'main' panicked at 'assertion failed: validate_hidpi_factor(dpi_factor)', .cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/winit-0.18.0/src/dpi.rs:236:9
shell.html:1246 note: Run with RUST_BACKTRACE=1 for a backtrace.

https://github.com/tomaka/winit/blob/master/src/dpi.rs#L236

    #[inline]
    pub fn to_physical(&self, dpi_factor: f64) -> PhysicalSize {
        assert!(validate_hidpi_factor(dpi_factor));
        let width = self.width * dpi_factor;
        let height = self.height * dpi_factor;
        PhysicalSize::new(width, height)
    }

@iceiix
Copy link
Owner Author

iceiix commented Jan 13, 2019

How to enable RUST_BACKTRACE with wasm32-unknown-emscripten? RUST_BACKTRACE=1 cargo build --target wasm32-unknown-emscripten doesn't appear to.

https://github.com/kvark/wasm-triangle example is from a year ago, but it has this information:

In Emscripten configuration, set USE_WEBGL2=1. I did it by just modifying emscripten/src/settings.js directly (from where it's installed). Hopefully, we'll be able to pass the linker parameters to emcc via cargo one day.

can it still not be passed? But RUST_BACKTRACE is for rustc, not emcc.

https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 has some introductory information

https://mozilla.logbot.info/rust/20180114

Hey o/, is there any way to enable RUST_BACKTRACE not using the env variable ? I'm trying to debug a panic on android, and i can't set it

You can set it from within your application

in rust code ?

or in a .toml file ?

Probably with doc.rust-lang.org/std/env/fn.set_var.html

std::env::set_var("RUST_BACKTRACE", "1"); as the first thing in main()

@iceiix
Copy link
Owner Author

iceiix commented Mar 3, 2019

To do:

  • Pass CI tests
  • Move instructions from readme to www/
  • Update readme for incompleteness

@iceiix iceiix changed the title WebAssembly support Add support for compiling WebAssembly wasm32-unknown-unknown target Mar 3, 2019
@iceiix
Copy link
Owner Author

iceiix commented Mar 3, 2019

https://travis-ci.org/iceiix/stevenarella/jobs/500994533 passed but it doesn't seem to have actually built for wasm:

$ if [[ "$WASM" == "true" ]]; then rustup target add wasm32-unknown-unknown; cargo install wasm-bindgen-cli; cargo install wasm-pack; travis_wait 120 wasm-pack build; else travis_wait 30 cargo build --verbose; cargo test --verbose; fi
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
    Updating crates.io index
  Installing wasm-bindgen-cli v0.2.37
error: binary `wasm-bindgen` already exists in destination as part of `wasm-bindgen-cli v0.2.37`
binary `wasm-bindgen-test-runner` already exists in destination as part of `wasm-bindgen-cli v0.2.37`
binary `wasm2es6js` already exists in destination as part of `wasm-bindgen-cli v0.2.37`
Add --force to overwrite
    Updating crates.io index
  Installing wasm-pack v0.6.0
error: binary `wasm-pack` already exists in destination as part of `wasm-pack v0.6.0`
Add --force to overwrite
Still running (7 of 120): wasm-pack build
The command wasm-pack build exited with 0.
Log:
   [INFO]: Optional fields missing from Cargo.toml: 'description', 'repository', and 'license'. These are not necessary, but recommended
/home/travis/.travis/functions: line 524:  6785 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
The command "if [[ "$WASM" == "true" ]]; then rustup target add wasm32-unknown-unknown; cargo install wasm-bindgen-cli; cargo install wasm-pack; travis_wait 120 wasm-pack build; else travis_wait 30 cargo build --verbose; cargo test --verbose; fi" exited with 0.
cache.2
store build cache
0.00s181.50schange detected (content changed, file is created, or file is deleted):
/home/travis/build/iceiix/stevenarella/target/release/build/glutin-833787e2ddc26081/build-script-build
/home/travis/build/iceiix/stevenarella/target/release/build/glutin-833787e2ddc26081/build_script_build-833787e2ddc26081
/home/travis/build/iceiix/stevenarella/target/release/build/glutin-833787e2ddc26081/build_script_build-833787e2ddc26081.d
/home/travis/build/iceiix/stevenarella/target/release/.fingerprint/glutin-833787e2ddc26081/build-script-build_script_build-833787e2ddc26081
/home/travis/build/iceiix/stevenarella/target/release/.fingerprint/glutin-833787e2ddc26081/build-script-build_script_build-833787e2ddc26081.json
/home/travis/build/iceiix/stevenarella/target/release/.fingerprint/glutin-833787e2ddc26081/dep-build-script-build_script_build-833787e2ddc26081
/home/travis/build/iceiix/stevenarella/target/release/.fingerprint/glutin-833787e2ddc26081/invoked.timestamp
/home/travis/build/iceiix/stevenarella/target/release/.fingerprint/steven_gl-008ce09412c9652a/build-script-build_scrip
...
changes detected, packing new archive

uploading wasm/cache-linux-trusty-3879e5e05f8e7b938c85cd9971db8997f2b1857f15cdc4d7dbe31cd1d57906c8--cargo-nightly.tgz
/home/travis/.casher/bin/casher:54: warning: constant ::TimeoutError is deprecated
running `casher push` took longer than 180 seconds and has been aborted.
You can extend the timeout with `cache.timeout`. See https://docs.travis-ci.com/user/caching/#Setting-the-timeout for details
Done. Your build exited with 0.

"Terminated travis_jigger " search finds travis-ci/travis-ci#4924 Host shut down during build, which was fixed last year.

uploading wasm/cache-linux-trusty-3879e5e05f8e7b938c85cd9971db8997f2b1857f15cdc4d7dbe31cd1d57906c8--cargo-nightly.tgz
/home/travis/.casher/bin/casher:54: warning: constant ::TimeoutError is deprecated
running `casher push` took longer than 180 seconds and has been aborted.
You can extend the timeout with `cache.timeout`. See https://docs.travis-ci.com/user/caching/#Setting-the-timeout for details

https://docs.travis-ci.com/user/caching/#Setting-the-timeout%20for%20details
@iceiix iceiix merged commit 2f2f358 into master Mar 3, 2019
@iceiix iceiix deleted the wasm branch March 3, 2019 16:32
iceiix added a commit that referenced this pull request May 22, 2019
Logging from the `log` facade goes to the colorized in-game GUI console (opened with the backtick key), as well as standard output using `println!` on the native build. To make this work on the wasm build, web-sys is used to access the `console` object, to call `console.log`, `console.warn`, and so on corresponding to the log levels. Extends #92, fails later (see also #115) but now outputs the starting up message:

[main.rs:206][INFO] Starting steven

* Add println! logging to console.log on wasm

* Initialize logger before config (called 'console variables' for some reason) to avoid having to disable it to reach the first logging statement

* Add web-sys crate for browser console access, wasm32-only

* Refactor logger to call println_level on both web/native

* Add multiple log levels, console.warn etc., matching console_log crate

https://github.com/iamcodemaker/console_log#details
iceiix added a commit that referenced this pull request Feb 1, 2020
)

Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

aweinstock314/rust-clipboard#62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: rustgd/collision-rs#106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.aaakk.us.kg-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for Frommi/miniz_oxide#42

* Update to official clipboard crate since aweinstock314/rust-clipboard#62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

iceiix/glutin#1

* Update winit dependency of glutin to git master

iceiix/winit#2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

iceiix/glutin@9779735
iceiix added a commit that referenced this pull request Feb 1, 2020
)

Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

aweinstock314/rust-clipboard#62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: rustgd/collision-rs#106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.aaakk.us.kg-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for Frommi/miniz_oxide#42

* Update to official clipboard crate since aweinstock314/rust-clipboard#62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

iceiix/glutin#1

* Update winit dependency of glutin to git master

iceiix/winit#2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

iceiix/glutin@9779735
iceiix added a commit that referenced this pull request Feb 1, 2020
)

Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

aweinstock314/rust-clipboard#62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: rustgd/collision-rs#106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.aaakk.us.kg-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for Frommi/miniz_oxide#42

* Update to official clipboard crate since aweinstock314/rust-clipboard#62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

iceiix/glutin#1

* Update winit dependency of glutin to git master

iceiix/winit#2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

iceiix/glutin@9779735
iceiix added a commit that referenced this pull request Feb 2, 2020
)

Note this only is the first step in web support, although the project compiles, it doesn't run!

Merging now to avoid branch divergence, until dependencies can be updated for wasm support.

* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/

* Update to rust-clipboard fork to compile with emscripten

aweinstock314/rust-clipboard#62

* Exclude reqwest dependency in wasm32

* Exclude compiling clipboard pasting on wasm32

* Exclude reqwest-using code from wasm32

* Install wasm target with rustup in Travis CI

* Update to collision 0.19.0

Fixes wasm incompatibility in deprecated rustc-serialize crate: rustgd/collision-rs#106

error[E0046]: not all trait items implemented, missing: `encode`
    --> github.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1

* Increase travis_wait time even further, try 120 minutes

* Set RUST_BACKTRACE=1 in main

* Remove unused unneeded bzip2 features in zip crate

To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
 --> src/github.aaakk.us.kg-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
  |
5 | use libc::{c_int, c_uint, c_void, c_char};
  |            ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^ no `c_char` in the root
  |            |      |       |
  |            |      |       no `c_void` in the root
  |            |      no `c_uint` in the root
  |            no `c_int` in the root

* flate2 use Rust backend

* Add console_error_panic_hook module for wasm backtraces

* Build using wasm-pack, wasm-bindgen, run with wasm-app

* Update to miniz_oxide 0.2.1, remove patch for Frommi/miniz_oxide#42

* Update to official clipboard crate since aweinstock314/rust-clipboard#62 was merged, but git revision pending release

* Update to branch of glutin attempting to build for wasm

iceiix/glutin#1

* Update winit dependency of glutin to git master

iceiix/winit#2

* Update to glutin branch with working (compiles, doesn't run) wasm_stub

* Add app name in title on web page

* Add wasm to Travis-CI test matrix

* Update glutin to fix Windows EGL compilation on AppVeyor

iceiix/glutin@9779735
iceiix added a commit that referenced this pull request Feb 2, 2020
The git dependency was only for wasm32-unknown-emscripten support:
aweinstock314/rust-clipboard#62
but #92 changes to using wasm32-unknown-unknown instead, a better
supported path (though still incomplete in this project, see #171)
@iceiix iceiix mentioned this pull request Dec 26, 2020
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant