Getting error while using opencv with rust on mac. I am not able to build it

aaqidmasoodi@Aaqids-MacBook-Air learn-rust % cargo build
Compiling libc v0.2.147
Compiling glob v0.3.1
Compiling memchr v2.6.3
Compiling regex-syntax v0.7.5
Compiling semver v1.0.18
Compiling cfg-if v1.0.0
Compiling dunce v1.0.4
Compiling once_cell v1.18.0
Compiling autocfg v1.1.0
Compiling percent-encoding v2.3.0
Compiling pkg-config v0.3.27
Compiling vcpkg v0.2.15
Compiling aho-corasick v1.0.5
Compiling clang-sys v1.6.1
Compiling num-traits v0.2.16
Compiling shlex v1.2.0
Compiling ppv-lite86 v0.2.17
Compiling regex-automata v0.3.8
Compiling jobserver v0.1.26
Compiling getrandom v0.2.10
Compiling cc v1.0.79
Compiling rand_core v0.6.4
Compiling rand_chacha v0.3.1
Compiling rand v0.8.5
Compiling clang v2.0.0
Compiling regex v1.9.5
Compiling opencv-binding-generator v0.72.0
Compiling opencv v0.84.5
Compiling learn-rust v0.1.0 (/Users/aaqidmasoodi/Documents/rust projects/learn-rust)
error: linking with cc failed: exit status: 1
|
= note: LC_ALL="C" PATH="/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/qt@5/bin:/usr/local/opt/qt/bin:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/usr/local/mysql/bin:/Users/aaqidmasoodi/.nvm/versions/node/v16.20.1/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/qt@5/bin:/usr/local/opt/qt/bin:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/usr/local/mysql/bin:/Users/aaqidmasoodi/.nvm/versions/node/v16.20.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/qt@5/bin:/usr/local/opt/qt/bin:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/Cellar/pyenv-virtualenv/1.2.1/shims:/usr/local/mysql/bin:/Users/aaqidmasoodi/.nvm/versions/node/v16.20.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/aaqidmasoodi/.cargo/bin:/Users/aaqidmasoodi/Library/Android/sdk/tools:/Users/aaqidmasoodi/Library/Android/sdk/platform-tools:/emulator:/tools/bin:/Users/aaqidmasoodi/Library/Android/sdk/tools:/Users/aaqidmasoodi/Library/Android/sdk/platform-tools:/emulator:/tools/bin:/Users/aaqidmasoodi/Library/Android/sdk/tools:/Users/aaqidmasoodi/Library/Android/sdk/platform-tools:/emulator:/tools/bin" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-arch" "arm64" "/var/folders/5l/bzfrgvk12jd7prg7d22q2rs40000gn/T/rustcN0xxQY/symbols.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.11ln8f9k7423rb4d.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.18ydcxzvb63q5hnk.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.1bijhzcwxhv5awd6.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.1nohumjxgy4i6rpx.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.1wm6n6qnu3d5kf1y.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.1yuc8d6c0b8w7woq.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.27bz5zhhtgf9rlqb.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.27cb0dbl00gpjcd3.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.2arahht17dz87rdc.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.2gfls50kwr9iwzhh.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.2jqobrd6n4v4fy1b.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.2kmmq3bvi2ciinjg.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.2y2434505wokfjo1.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.3telpga6biwuc3bw.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.3zaj4lgoi7vl29j9.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.428kj3zjj042d8c.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.4bm4u9x27aolxcpd.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.4ddcztws7qw0iwwa.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.4g3de8oggdeuf2r2.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.4u0exy7jv9a8dlgr.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.52gqhqnibkj8dax5.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.52rvu37ea24sc2dc.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.66avc5agzk3cyw6.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.kiaqcy2dn4wbkqe.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.y3aw5llrfs0v2ok.rcgu.o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43.1gaw27me8dwuy7qq.rcgu.o" "-L" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps" "-L" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/build/opencv-136f622ef68154a4/out" "-L" "/opt/homebrew/Cellar/opencv/4.8.0_4/lib" "-F" "/opt/homebrew/Cellar/opencv/4.8.0_4/lib" "-L" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/libopencv-5da634adddb80ad4.rlib" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/liblibc-d6e98f05428589f9.rlib" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/libnum_traits-f5163cef90d35a06.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-d7b0465d1109e375.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-52f04dd60555f024.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-b306a017bac4b3d2.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-dba588a19c73c7af.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-5c46c7f08bf5b6af.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-27d0f103778afa71.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-60f1d4a402bae488.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-d0efa2cbe0a1cc2b.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-8a83d6ac2d6c7e6f.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-dd9a9a1931ea259d.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-6e19db4d0b2d2e2f.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libadler-2ac9e8b0bb807b33.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-9c37defb58e48ce2.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-6180b3afb30bc9bc.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-766469dabaf94e04.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-13afcd27d2ea8bdb.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-c86f5c425478c159.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-4d1bcee94adb237f.rlib" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-02876b9130340342.rlib" "-lc++" "-lopencv_world" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/aaqidmasoodi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/aaqidmasoodi/Documents/rust projects/learn-rust/target/debug/deps/learn_rust-656f36c8b9663c43" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: library not found for -lopencv_world
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile learn-rust (bin "learn-rust") due to previous error

Please show me how to properly setup everything on macos

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.