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

error: could not compile mediapipe-rs by Mac m2 #10

Open
cuisongliu opened this issue Jun 25, 2024 · 6 comments
Open

error: could not compile mediapipe-rs by Mac m2 #10

cuisongliu opened this issue Jun 25, 2024 · 6 comments

Comments

@cuisongliu
Copy link

cuisongliu commented Jun 25, 2024

[23:13:29] [~/Workspaces/rust/wasm/mediapipe-rs] git(main) ❱❱❱ cargo run --release --example image_classification -- ./assets/models/image_classification/efficientnet_lite0_fp32.tflite ./assets/testdata/img/burger.jpg 
   Compiling autocfg v1.2.0
   Compiling libm v0.2.8
   Compiling bytemuck v1.15.0
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.79
   Compiling bitflags v1.3.2
   Compiling semver v1.0.22
   Compiling wasi v0.11.0+wasi-snapshot-preview1
   Compiling unicode-ident v1.0.12
   Compiling paste v1.0.14
   Compiling getrandom v0.2.14
   Compiling lazy_static v1.4.0
   Compiling arrayvec v0.7.4
   Compiling log v0.4.21
   Compiling rand_core v0.6.4
   Compiling num-traits v0.2.18
   Compiling num-bigint v0.4.4
   Compiling num-rational v0.4.1
   Compiling symphonia-core v0.5.4
   Compiling quote v1.0.36
   Compiling matrixmultiply v0.3.8
   Compiling safe_arch v0.7.1
   Compiling ppv-lite86 v0.2.17
   Compiling typenum v1.17.0
   Compiling rand_chacha v0.3.1
   Compiling rustc_version v0.4.0
   Compiling num-integer v0.1.46
   Compiling num-complex v0.4.5
   Compiling approx v0.5.1
   Compiling syn v2.0.58
   Compiling wide v0.7.15
   Compiling memchr v2.7.2
   Compiling thiserror v1.0.58
   Compiling ttf-parser v0.20.0
   Compiling rawpointer v0.2.1
   Compiling zune-core v0.4.12
   Compiling aho-corasick v1.1.3
   Compiling zune-jpeg v0.4.11
   Compiling owned_ttf_parser v0.20.0
   Compiling simba v0.8.1
   Compiling thiserror-impl v1.0.58
   Compiling num-iter v0.1.44
   Compiling flatbuffers v23.5.26
   Compiling rand v0.8.5
   Compiling encoding_rs v0.8.34
   Compiling regex-syntax v0.8.3
   Compiling byteorder v1.5.0
   Compiling either v1.11.0
   Compiling ab_glyph_rasterizer v0.1.8
   Compiling custom_derive v0.1.7
   Compiling itertools v0.12.1
   Compiling conv v0.3.3
   Compiling ab_glyph v0.2.25
   Compiling image v0.25.1
   Compiling symphonia-metadata v0.5.4
   Compiling regex-automata v0.4.6
   Compiling rand_distr v0.4.3
   Compiling num v0.4.2
   Compiling mediapipe-rs v0.1.0-dev (/Users/cuisongliu/Workspaces/rust/wasm/mediapipe-rs)
   Compiling extended v0.1.0
   Compiling symphonia-format-riff v0.5.4
   Compiling wasi-nn v0.4.0
   Compiling symphonia-codec-pcm v0.5.4
   Compiling symphonia v0.5.4
   Compiling nalgebra v0.32.5
   Compiling regex v1.10.4
   Compiling imageproc v0.24.0
error[E0277]: the trait bound `f32: conv::ValueFrom<<<I as image_crate::GenericImageView>::Pixel as image_crate::Pixel>::Subpixel>` is not satisfied
   --> src/postprocess/utils/vision/draw_detections.rs:126:21
    |
125 |                 drawing::draw_text_mut(
    |                 ---------------------- required by a bound introduced by this call
126 |                     img,
    |                     ^^^ the trait `conv::ValueFrom<<<I as image_crate::GenericImageView>::Pixel as image_crate::Pixel>::Subpixel>` is not implemented for `f32`, which is required by `<<I as image_crate::GenericImageView>::Pixel as image_crate::Pixel>::Subpixel: conv::ValueInto<f32>`
    |
    = note: required for `<<I as image_crate::GenericImageView>::Pixel as image_crate::Pixel>::Subpixel` to implement `conv::ValueInto<f32>`
note: required by a bound in `draw_text_mut`
   --> /Users/cuisongliu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/imageproc-0.24.0/src/drawing/text.rs:62:36
    |
52  | pub fn draw_text_mut<C>(
    |        ------------- required by a bound in this function
...
62  |     <C::Pixel as Pixel>::Subpixel: ValueInto<f32> + Clamp<f32>,
    |                                    ^^^^^^^^^^^^^^ required by this bound in `draw_text_mut`
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
    |
59  |     I::Pixel: 'static, f32: conv::ValueFrom<<<I as image_crate::GenericImageView>::Pixel as image_crate::Pixel>::Subpixel>
    |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0277`.
error: could not compile `mediapipe-rs` (lib) due to 1 previous error

support Mac m2 ?

@MediosZ
Copy link

MediosZ commented Sep 27, 2024

The code compiles on my mac m2.
Could you confirm if the code still cannot compile on your machine?

@cuisongliu
Copy link
Author

cuisongliu commented Oct 1, 2024

rust version is ?
my rust version
rustc 1.78.0 (9b00956e5 2024-04-29) .
cargo 1.78.0 (54d8815d0 2024-03-26)

@MediosZ
Copy link

MediosZ commented Oct 2, 2024

mine is rustc 1.79.0 (129f3b996 2024-06-10)

@MediosZ
Copy link

MediosZ commented Oct 2, 2024

I find it's the problem with imageproc, try upgrading it to 0.25.0

@cuisongliu
Copy link
Author

[01:29:34] [~/Workspaces/rust/wasm/mediapipe-rs] git(main) 🔥 ❱❱❱ cargo run --release --example gesture_recognition -- ./assets/models/gesture_recognition/gesture_recognizer.task ./assets/testdata/img/gesture_recognition_google_samples/victory.jpg
   Compiling mediapipe-rs v0.1.0-dev (/Users/cuisongliu/Workspaces/rust/wasm/mediapipe-rs)
    Finished `release` profile [optimized] target(s) in 5.95s
     Running `/Users/cuisongliu/Workspaces/rust/wasm/mediapipe-rs/./scripts/wasmedge-runner.sh target/wasm32-wasi/release/examples/gesture_recognition.wasm ./assets/models/gesture_recognition/gesture_recognizer.task ./assets/testdata/img/gesture_recognition_google_samples/victory.jpg`
[2024-10-05 01:29:42.425] [error] [WASI-NN] TensorflowLite backend is not built. use -WASMEDGE_PLUGIN_WASI_NN_BACKEND="Tensorflowlite" to build it.
Error: WasiNNError(BackendError(InvalidArgument))

I need rebuild wasmedge use -WASMEDGE_PLUGIN_WASI_NN_BACKEND="Tensorflowlite" ???

@MediosZ
Copy link

MediosZ commented Oct 9, 2024

Did you install WasmEdge with the installer script? I think there's one option that installed the correct build.
Otherwise, you can build it from source with this command cmake -B build -S . -GNinja -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_TENSORFLOWLITE=ON -DWASMEDGE_PLUGIN_WASI_NN_BACKEND=TensorFlowLite

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

2 participants