This is the error I'm getting:
Compiling opencv v0.91.3
error: failed to run custom build command for `opencv v0.91.3`
Caused by:
process didn't exit successfully: `/Users/baguma/Desktop/vkrust/target/debug/build/opencv-24a3479338500f97/build-script-build` (signal: 6, SIGABRT: process abort signal)
--- stderr
dyld[16064]: Library not loaded: '@rpath/libclang.dylib'
Referenced from: '/Users/baguma/Desktop/vkrust/target/debug/build/opencv-24a3479338500f97/build-script-build'
Reason: tried: '/Users/baguma/Desktop/vkrust/target/debug/deps/libclang.dylib' (no such file), '/Users/baguma/Desktop/vkrust/target/debug/libclang.dylib' (no such file), '/Users/baguma/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libclang.dylib' (no such file), '/Users/baguma/.rustup/toolchains/stable-x86_64-apple-darwin/lib/libclang.dylib' (no such file), '/Users/baguma/lib/libclang.dylib' (no such file), '/usr/local/lib/libclang.dylib' (no such file), '/usr/lib/libclang.dylib' (no such file)
I dont understand the meaning of that. I installed opencv on my system using homebrew but I guess I needed to do a specific installation for Rust so I went to crates.io
and pasted the opencv version in my Cargo.toml
Then tried to run cargo build
, all the other packages built successfully except this one.
This is the Cargo.toml
file:
[package]
name = "rust-opencv"
version = "0.1.0"
edition = "2021"
[dependencies]
opencv = "0.91.3"
cgmath = "0.18.0"
algebra = "0.2.0"
You need to enable the clang-runtime
feature to properly build the libclang
on MacOs
[dependencies]
opencv = { version = "0.91.3", features = ["clang-runtime"] }