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

WebAssembly compile stub #1

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

WebAssembly compile stub #1

wants to merge 21 commits into from

Conversation

iceiix
Copy link
Owner

@iceiix iceiix commented Mar 2, 2019

Attempting to adapt glutin to compile (but not run) under the wasm32-unknown-unknown target

temporary for iceiix/stevenarella#92

@iceiix iceiix changed the title WebAssembly compile stubs WebAssembly compile stub Mar 2, 2019
@iceiix
Copy link
Owner Author

iceiix commented Mar 2, 2019

rust-windowing#1108 Use the shared_library dependency only on required platforms

@iceiix
Copy link
Owner Author

iceiix commented Mar 2, 2019

      Updating git repository `https://github.com/iceiix/glutin`
     Compiling winit v0.18.1
     Compiling glutin v0.19.0 (https://github.com/iceiix/glutin?branch=wasm_stub#903059f7)
  error: The platform you're compiling for is not supported by winit
    --> .cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.18.1/src/platform/mod.rs:26:1
     |
  26 | compile_error!("The platform you're compiling for is not supported by winit");
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  error: aborting due to previous error
  
  error: Could not compile `winit`.
  warning: build failed, waiting for other jobs to finish...
| error: build failed
Compiling your crate to WebAssembly
Caused by: Process exited with 

@iceiix
Copy link
Owner Author

iceiix commented Mar 2, 2019

glutin $ cargo build --target wasm32-unknown-unknown
   Compiling glutin v0.19.0 (glutin)
error[E0432]: unresolved import `self::platform`
 --> src/platform/mod.rs:1:15
  |
1 | pub use self::platform::*;
  |               ^^^^^^^^ could not find `platform` in `self`

error[E0432]: unresolved import `this_platform_is_not_supported`
  --> src/platform/mod.rs:40:5
   |
40 | use this_platform_is_not_supported;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `this_platform_is_not_supported` in the root

error[E0433]: failed to resolve: could not find `Context` in `platform`
  --> src/combined.rs:58:19
   |
58 |         platform::Context::new(wb, el, &pf_reqs, &gl_attr).map(
   |                   ^^^^^^^ could not find `Context` in `platform`

error[E0433]: failed to resolve: could not find `Context` in `platform`
  --> src/context.rs:64:19
   |
64 |         platform::Context::new_context(el, &pf_reqs, &gl_attr)
   |                   ^^^^^^^ could not find `Context` in `platform`

error[E0433]: failed to resolve: could not find `Context` in `platform`
  --> src/separated.rs:59:19
   |
59 |         platform::Context::new_separated(window, el, &pf_reqs, &gl_attr).map(
   |                   ^^^^^^^ could not find `Context` in `platform`

error[E0412]: cannot find type `Context` in module `platform`
  --> src/context.rs:26:35
   |
26 |     pub(crate) context: platform::Context,
   |                                   ^^^^^^^ not found in `platform`
help: possible candidate is found in another module, you can import it into scope
   |
1  | use context::Context;
   |

warning: unused import: `this_platform_is_not_supported`
  --> src/platform/mod.rs:40:5
   |
40 | use this_platform_is_not_supported;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_imports)] on by default

error: aborting due to 6 previous errors

Some errors occurred: E0412, E0432, E0433.
For more information about an error, try `rustc --explain E0412`.
error: Could not compile `glutin`.

iceiix added a commit to iceiix/stevenarella that referenced this pull request Mar 2, 2019
@iceiix
Copy link
Owner Author

iceiix commented Mar 2, 2019

This now builds

iceiix added a commit to iceiix/stevenarella that referenced this pull request Mar 3, 2019
)

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.com-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.com-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 to iceiix/stevenarella that referenced this pull request May 19, 2019
iceiix added a commit to iceiix/stevenarella that referenced this pull request May 20, 2019
Updating the glutin dependency to a 0.21.0-based branch, based on the migration guide at:
https://gentz.rocks/posts/glutin-v0-21-0-migration-guide/

* Remove glutin::ContextTrait

* Create window with ContextBuilder instead of WindowedContext::new

* Add .window() accessor on WindowContext, since it now dereferences to Context

In order to not break wasm32-unknown-unknown compilation, a minor fork is used of glutin v0.21.0 and a corresponding version of winit: iceiix/glutin#1 iceiix/winit#2
 - with stubs to compile (but not run, see issue #115)
@iceiix
Copy link
Owner Author

iceiix commented May 23, 2019

iceiix/stevenarella#115

iceiix added a commit to iceiix/stevenarella 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.com-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.com-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 to iceiix/stevenarella 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.com-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.com-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 to iceiix/stevenarella 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.com-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.com-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 to iceiix/stevenarella 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.com-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.com-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
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