Hi, have you used opencv rust package? I have tried to install it many ways. I have installed clang llvm and every possible library that any of docs or forums asked to install. But still I can't run even the "opencv Hello world".
All the terminal checks say, that everything is Ok.
`pkg-config --modversion opencv4
4.5.4`
`dpkg -l libopencv-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-===================-============-===========================>
ii libopencv-dev 4.5.4+dfsg-9ubuntu4 amd64 development files for opencv
(base)`
I am using Cursor or VSCode, and the rust-analyzer is getting crazy with opencv used:
On cargo run:
error: failed to run custom build command for opencv v0.92.0
I have set some env variables there(in .bashrc):
`
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
export CXXFLAGS="-std=c++11 -isystem /usr/include/c++/11"`
but it still doesn't work
Maybe that's, because of missing configuration. However, there are many missing files and directories, that I have to direct.
` === Environment configuration:
=== OPENCV_PACKAGE_NAME = None
=== OPENCV_PKGCONFIG_NAME = None
=== OPENCV_CMAKE_NAME = None
=== OPENCV_CMAKE_BIN = None
=== OPENCV_VCPKG_NAME = None
=== OPENCV_LINK_LIBS = None
=== OPENCV_LINK_PATHS = None
=== OPENCV_INCLUDE_PATHS = None
=== OPENCV_DISABLE_PROBES = None
=== OPENCV_MSVC_CRT = None
=== CMAKE_PREFIX_PATH = None
=== OpenCV_DIR = None
=== PKG_CONFIG_PATH = Some("/usr/lib/pkgconfig")
=== VCPKG_ROOT = None
=== VCPKGRS_DYNAMIC = None
=== VCPKGRS_TRIPLET = None
=== OCVRS_DOCS_GENERATE_DIR = None
=== DOCS_RS = None
=== PATH = Some("/home/wiktor/.yarn/bin:/home/wiktor/.config/yarn/global/node_modules/.bin:/usr/local/cuda-12.2/bin:/home/wiktor/anaconda3/bin:/home/wiktor/.local/bin:/home/wiktor/anaconda3/bin:/home/wiktor/anaconda3/condabin:/home/wiktor/.yarn/bin:/home/wiktor/.config/yarn/global/node_modules/.bin:/usr/local/cuda-12.2/bin:/home/wiktor/anaconda3/bin:/tmp/.mount_cursorzXIVlA:/tmp/.mount_cursorzXIVlA/usr/sbin:/home/wiktor/.cargo/bin:/home/wiktor/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/wiktor/n/bin")`
I have also tried to install it from the source. Based on that: How to Install OpenCV on Ubuntu | phoenixNAP KB
After make -j3
at some moment I get this:
`[ 38%] Linking CXX executable ../../bin/opencv_test_videoio
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_get_keys_as_ptr_array'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_timeout_add_seconds_once'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_string_free_and_steal'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_steal_all_values'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_ptr_array_sort_values'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_get_values_as_ptr_array'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_steal_all_keys'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_assertion_message_cmpint'
collect2: error: ld returned 1 exit status
make[2]: *** [modules/videoio/CMakeFiles/opencv_perf_videoio.dir/build.make:160: bin/opencv_perf_videoio] Error 1
make[1]: *** [CMakeFiles/Makefile2:8456: modules/videoio/CMakeFiles/opencv_perf_videoio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 38%] Building CXX object modules/calib3d/CMakeFiles/opencv_test_calib3d.dir/test/test_affine2d_estimator.cpp.o
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_get_keys_as_ptr_array'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_timeout_add_seconds_once'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_string_free_and_steal'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2.0.so.0: undefined reference to `g_hash_table_steal_all_values'
/usr/bin/ld: /home/wiktor/anaconda3/lib/libgio-2
Btw. It works perfectly fine with Python, so I don't know, what's the problem.