GithubHelp home page GithubHelp logo

Comments (4)

38 avatar 38 commented on July 25, 2024

Hi there,

What IDE are you using? I am personally doesn't use any IDE. But it seems the IDE doesn't use WASM target to compile the code. Please note the CnavasBackend would be enabled only when the target is wasm32. (See examples/wasm-demo/start-server.sh for details)

Would you mind try to reproduce this with cargo build with a CLI output and share your Cargo.toml with me ?

Hope this is helpful :-)

from plotters.

wmain avatar wmain commented on July 25, 2024

Thanks for the quick reply!

Here's build output:

   Compiling nodrop v0.1.13
   Compiling scopeguard v1.0.0
   Compiling foreign-types-shared v0.1.1
   Compiling either v1.5.2
   Compiling adler32 v1.0.3
   Compiling color_quant v1.0.1
   Compiling lzw v0.10.0
   Compiling scoped_threadpool v0.1.9
   Compiling approx v0.1.1
   Compiling memory_units v0.4.0
   Compiling svg v0.5.12
   Compiling crossbeam-utils v0.6.6
   Compiling foreign-types v0.3.2
   Compiling arrayvec v0.4.11
   Compiling libc v0.2.62
   Compiling core-foundation-sys v0.6.2
   Compiling bitflags v1.1.0
   Compiling byteorder v1.3.2
   Compiling num-traits v0.2.8
   Compiling inflate v0.4.5
   Compiling memoffset v0.5.1
   Compiling wasm-bindgen v0.2.50
   Compiling gif v0.10.2
   Compiling crossbeam-queue v0.1.2
   Compiling crossbeam-epoch v0.7.2
   Compiling stb_truetype v0.3.0
   Compiling deflate v0.7.20
   Compiling num_cpus v1.10.1
   Compiling core-foundation v0.6.4
   Compiling time v0.1.42
   Compiling wee_alloc v0.4.5
   Compiling crossbeam-deque v0.7.1
   Compiling core-graphics v0.14.0
   Compiling rayon-core v1.6.0
   Compiling num-integer v0.1.41
   Compiling approx v0.3.2
   Compiling ordered-float v1.0.2
   Compiling tiff v0.2.2
   Compiling palette v0.4.1
   Compiling core-text v10.0.0
   Compiling rusttype v0.8.0
   Compiling font-loader v0.8.0
   Compiling rayon v1.2.0
   Compiling num-iter v0.1.39
   Compiling num-rational v0.2.2
   Compiling chrono v0.4.9
   Compiling png v0.14.1
   Compiling rusttype v0.7.9
   Compiling jpeg-decoder v0.1.16
   Compiling image v0.21.3
   Compiling plotters v0.2.5 (/Users/wmain/projects/plotters)
   Compiling wasm-demo v0.1.0 (/Users/wmain/projects/plotters/examples/wasm-demo)
error[E0433]: failed to resolve: use of undeclared type or module `CanvasBackend`
 --> src/func_plot.rs:8:19
  |
8 |     let backend = CanvasBackend::new(element).unwrap();
  |                   ^^^^^^^^^^^^^ use of undeclared type or module `CanvasBackend`

error[E0433]: failed to resolve: use of undeclared type or module `CanvasBackend`
  --> src/mandelbrot.rs:33:19
   |
33 |     let backend = CanvasBackend::new(element).unwrap();
   |                   ^^^^^^^^^^^^^ use of undeclared type or module `CanvasBackend`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0433`.
error: Could not compile `wasm-demo`.

Cargo.toml

[package]
name = "wasm-demo"
version = "0.1.0"
authors = ["Hao Hou <[email protected]>"]
edition = "2018"

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

[dependencies]
plotters = {path = "../.."}
wasm-bindgen = "0.2.43"
wee_alloc = "*"

[profile.release]
lto = true

from plotters.

wmain avatar wmain commented on July 25, 2024

Adding the target totally fixes this I think! Thanks for the quick response :). This can be closed.

from plotters.

38 avatar 38 commented on July 25, 2024

Awesome, closing the issue, feel free to reopen it if anything isn't right :)

from plotters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.