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

WASM support #4

Open
blaind opened this issue May 16, 2022 · 1 comment
Open

WASM support #4

blaind opened this issue May 16, 2022 · 1 comment

Comments

@blaind
Copy link
Owner

blaind commented May 16, 2022

WASM is not currently supported. Investigate solutions to build for it.

@blaind
Copy link
Owner Author

blaind commented May 16, 2022

Error message:

$ cargo build --target wasm32-unknown-unknown
[...]
   Compiling ttf2mesh-sys v0.1.2 (/ttf2mesh-rs/ttf2mesh-sys)
The following warnings were emitted during compilation:

warning: ttf2mesh/ttf2mesh.c:42:13: fatal error: 'dirent.h' file not found
warning: #   include <dirent.h>
warning:             ^~~~~~~~~~
warning: 1 error generated.

The root cause is, that ttf2mesh-sys needs to build the ttf2mesh.c as an intermediate target to be linked into the final wasm binary by rust. Not sure, what would be the best way to do it.

One (possible?) option is to use emscripten, after installing it and:

CC=emcc cargo build --target wasm32-unknown-unknown

This goes a step further, but results into multiple errors of sys::ttf_ missing, e.g.

error[E0425]: cannot find function `ttf_glyph2mesh3d` in crate `sys`
  --> src/glyph.rs:64:18
   |
64 |             sys::ttf_glyph2mesh3d(
   |                  ^^^^^^^^^^^^^^^^ not found in `sys`

these are exposed by ttf2mesh-sys/ttf2mesh/ttf2mesh.h, and bindings generated by bindgen at ttf2mesh-sys/build.rs

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

No branches or pull requests

1 participant