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

Build target wasm32-unknown-unknown supported? #289

Closed
itsHabib opened this issue Feb 16, 2019 · 2 comments
Closed

Build target wasm32-unknown-unknown supported? #289

itsHabib opened this issue Feb 16, 2019 · 2 comments
Assignees
Labels
Build Compilation, environment

Comments

@itsHabib
Copy link

itsHabib commented Feb 16, 2019

Hello I had an idea try to embed a gprc client using wasm. Whenever I try to build with a target of wasm32-unknown-unknown it fails with the exception below. I'm not even sure if this is possible to do but I wanted to see if any else had an opinion on the issue.

+ cargo build --target wasm32-unknown-unknown
   Compiling grpcio-sys v0.4.2
error[E0432]: unresolved imports `libc::c_char`, `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::int32_t`, `libc::int64_t`, `libc::size_t`, `libc::uint32_t`
  --> /home/itshabib/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.4.2/src/lib.rs:18:12
   |
18 | use libc::{c_char, c_int, c_uint, c_void, int32_t, int64_t, size_t, uint32_t};
   |            ^^^^^^  ^^^^^  ^^^^^^  ^^^^^^  ^^^^^^^  ^^^^^^^  ^^^^^^  ^^^^^^^^ no `uint32_t` in the root
   |            |       |      |       |       |        |        |
   |            |       |      |       |       |        |        no `size_t` in the root
   |            |       |      |       |       |        no `int64_t` in the root
   |            |       |      |       |       no `int32_t` in the root
   |            |       |      |       no `c_void` in the root
   |            |       |      no `c_uint` in the root
   |            |       no `c_int` in the root
   |            no `c_char` in the root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: Could not compile `grpcio-sys`.

Cargo.toml

[package]
name = "grpc-client"
version = "0.1.0"
authors = ["Michael Habib <mhabib@pixability.com>"]
edition = "2018"

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

[dependencies]
wasm-bindgen = "0.2.37"
grpcio = "0.4.3"
futures = "^0.1.15"
protobuf = "2.3.0"

Project code: https://github.com/itsHabib/wasm-grpc/tree/master/grpc-client

OS

uname -a
Linux mh 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Rust version

rustc --version
rustc 1.34.0-nightly (f29b4fbd7 2019-01-31)
@itsHabib itsHabib changed the title Build target wasm32-unknown-unknown not supported? Build target wasm32-unknown-unknown supported? Feb 16, 2019
@ice1000 ice1000 added the Build Compilation, environment label Feb 16, 2019
@BusyJay
Copy link
Member

BusyJay commented Feb 19, 2019

I have limited knowledge about WASM. And I doubt whether the gRPC core library works for WASM at all. You are welcome to share your experience when you make it.

@ice1000
Copy link
Contributor

ice1000 commented Feb 19, 2019

grpc/grpc-go#2294

Wasm, by design, doesn't have low level networking support, so this request is inherently impossible.

This does not seem to be approachable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Compilation, environment
Projects
None yet
Development

No branches or pull requests

3 participants