opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

OpenCV not found.

Open suqiernb opened this issue 1 year ago • 5 comments

  • WinGet install LLVM.LLVM
  • vcpkg install opencv4[contrib,nonfree]:x64-windows-static
Computing installation plan...
The following packages are already installed:
    opencv4[core,win32ui,webp,tiff,thread,quirc,png,nonfree,jpeg,intrinsics,highgui,gapi,fs,dshow,dnn,default-features,contrib,calib3d]:[email protected]#2
opencv4:x64-windows-static is already installed
Total install time: 157 us
opencv4 is compatible with built-in CMake variables. In case of multiple OpenCV version installed, set OpenCV_ROOT *before* the find_package call:

    set(OpenCV_ROOT "${VCPKG_INSTALLED_DIR}/x64-windows-static/share/opencv4")
    find_package(OpenCV REQUIRED)
  • logger
=== Crate version: 0.93.5
  === 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 = None
  ===   VCPKG_ROOT = Some("F:\\vcpkg")
  ===   VCPKGRS_DYNAMIC = None
  ===   VCPKGRS_TRIPLET = None
  ===   OCVRS_DOCS_GENERATE_DIR = None
  ===   DOCS_RS = None
  ===   PATH = Some("D:\\WorkSpace\\CrossPlatform\\ninja3\\src-tauri\\target\\debug\\deps;D:\\WorkSpace\\CrossPlatform\\ninja3\\src-tauri\\target\\debug;D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib;D:\\Programs\\VMware\\bin\\;C:\\Program Files\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;D:\\Windows Kits\\10\\Windows Performance Toolkit\\;D:\\Android\\SDK\\ndk\\26.1.10909125;D:\\Android\\SDK\\platform-tools;D:\\Programs\\Redis\\;D:\\Programs\\nodejs\\;D:\\Programs\\Bandizip\\Bandizip;D:\\Programs\\Bandizip;D:\\Programs\\NetSarang\\Xftp 7\\;D:\\Programs\\NetSarang\\Xshell 7\\;D:\\Programs\\AnaConda;D:\\Programs\\AnaConda\\Scripts;D:\\Programs\\AnaConda\\Library\\bin;D:\\Programs\\AnaConda\\Library\\mingw-w64\\bin;D:\\Programs\\AnaConda\\Library\\usr\\bin;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;D:\\Programs\\Rust\\Cargo\\bin;D:\\Programs\\Git\\cmd;D:\\WorkSpace\\bin;F:\\vcpkg;C:\\Program Files\\LLVM\\bin;D:\\Programs\\ZeroC_ICE\\bin;D:\\Programs\\mongodb\\bin;C:\\Program Files (x86)\\dotnet\\;C:\\Program Files\\PowerShell\\7\\;D:\\Programs\\Cmake\\bin;C:\\Users\\23073\\scoop\\shims;D:\\Programs\\Rust\\Cargo\\bin;C:\\Users\\23073\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\23073\\AppData\\Local\\JetBrains\\Toolbox\\scripts;;D:\\Programs\\Microsoft VS Code\\bin;C:\\Users\\23073\\AppData\\Roaming\\npm")
  === Enabled features:
  ===   ALPHAMAT
  ===   ARUCO
  ===   ARUCO_DETECTOR
  ===   BARCODE
  ===   BGSEGM
  ===   BIOINSPIRED
  ===   CALIB3D
  ===   CCALIB
  ===   CUDAARITHM
  ===   CUDABGSEGM
  ===   CUDACODEC
  ===   CUDAFEATURES2D
  ===   CUDAFILTERS
  ===   CUDAIMGPROC
  ===   CUDAOBJDETECT
  ===   CUDAOPTFLOW
  ===   CUDASTEREO
  ===   CUDAWARPING
  ===   CVV
  ===   DEFAULT
  ===   DNN
  ===   DNN_SUPERRES
  ===   DPM
  ===   FACE
  ===   FEATURES2D
  ===   FLANN
  ===   FREETYPE
  ===   FUZZY
  ===   GAPI
  ===   HDF
  ===   HFS
  ===   HIGHGUI
  ===   IMGCODECS
  ===   IMGPROC
  ===   IMG_HASH
  ===   INTENSITY_TRANSFORM
  ===   LINE_DESCRIPTOR
  ===   MCC
  ===   ML
  ===   OBJDETECT
  ===   OPTFLOW
  ===   OVIS
  ===   PHASE_UNWRAPPING
  ===   PHOTO
  ===   PLOT
  ===   QUALITY
  ===   RAPID
  ===   RGBD
  ===   SALIENCY
  ===   SFM
  ===   SHAPE
  ===   STEREO
  ===   STITCHING
  ===   STRUCTURED_LIGHT
  ===   SUPERRES
  ===   SURFACE_MATCHING
  ===   TEXT
  ===   TRACKING
  ===   VIDEO
  ===   VIDEOIO
  ===   VIDEOSTAB
  ===   VIZ
  ===   WECHAT_QRCODE
  ===   XFEATURES2D
  ===   XIMGPROC
  ===   XOBJDETECT
  ===   XPHOTO
  === Detected probe priority boost based on environment vars: pkg_config: false, cmake: false, vcpkg: true
  === Probing the OpenCV library in the following order: environment, vcpkg_cmake, vcpkg, pkg_config, cmake
  === Can't probe using: environment, continuing with other methods because: Some environment variables are missing
  === Probing OpenCV library using vcpkg_cmake
  === Discovered vcpkg root: F:\vcpkg
  === Probing OpenCV library using cmake with toolchain: F:\vcpkg\scripts/buildsystems/vcpkg.cmake
  === cmake ninja probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=F:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Debug" "-G" "Ninja"
  === Probing with cmake ninja generator failed, will try Makefile generator, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Ninja\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake makefiles probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=F:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Debug" "-G" "Unix Makefiles"
  === Probing with cmake Makefile generator failed, will try deprecated find_package, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Unix Makefiles\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake find-package compile probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=F:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Debug" "--find-package" "-DCOMPILER_ID=GNU" "-DLANGUAGE=CXX" "-DMODE=COMPILE" "-DNAME=OpenCV"
  === Can't probe using: vcpkg_cmake, continuing with other methods because: cmake returned an error
      stdout: "OpenCV not found.\r\n"
      stderr: "CMake Error: Run 'cmake --help' for all supported options.\n"
  === Probing OpenCV library using vcpkg
  === Can't probe using: vcpkg, continuing with other methods because: Could not find library in Vcpkg tree package opencv4 is not installed for vcpkg triplet x64-windows-static-md, Could not find library in Vcpkg tree package opencv3 is not installed for vcpkg triplet x64-windows-static-md
  === Probing OpenCV library using pkg_config
  === Can't probe using: pkg_config, continuing with other methods because: Could not run `PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags opencv4`
  The pkg-config command could not be found.
  Most likely, you need to install a pkg-config package for your OS.
  If you've already installed it, ensure the pkg-config command is one of the
  directories in the PATH environment variable.
  If you did not expect this build to link to a pre-installed system library,
  then check documentation of the opencv crate for an option to
  build the library from source, or disable features or dependencies
  that require pkg-config., Could not run `PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags opencv`
  The pkg-config command could not be found.
  Most likely, you need to install a pkg-config package for your OS.
  If you've already installed it, ensure the pkg-config command is one of the
  directories in the PATH environment variable.
  If you did not expect this build to link to a pre-installed system library,
  then check documentation of the opencv crate for an option to
  build the library from source, or disable features or dependencies
  that require pkg-config.
  === Probing OpenCV library using cmake
  === cmake ninja probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Debug" "-G" "Ninja"
  === Probing with cmake ninja generator failed, will try Makefile generator, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Ninja\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake makefiles probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Debug" "-G" "Unix Makefiles"
  === Probing with cmake Makefile generator failed, will try deprecated find_package, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Unix Makefiles\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake find-package compile probe command: "cmake" "-S" "D:\\Programs\\Rust\\Cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.5\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Debug" "--find-package" "-DCOMPILER_ID=GNU" "-DLANGUAGE=CXX" "-DMODE=COMPILE" "-DNAME=OpenCV"
  === Can't probe using: cmake, continuing with other methods because: cmake returned an error
      stdout: "OpenCV not found.\r\n"
      stderr: "CMake Error: Run 'cmake --help' for all supported options.\n"
  Error: "Failed to find installed OpenCV package using probes: environment, vcpkg_cmake, vcpkg, pkg_config, cmake, refer to https://github.com/twistedfall/opencv-rust#getting-opencv for help"

suqiernb avatar Dec 24 '24 11:12 suqiernb

image

vcpkg install opencv4[contrib,nonfree,opencl]

1mZ1kk4d0 avatar Dec 30 '24 02:12 1mZ1kk4d0

Can you please double-check that your VCPKG_ROOT = F:\\vcpkg is correct? Vcpkg specifically says:

  === Can't probe using: vcpkg, continuing with other methods because: Could not find library in Vcpkg tree package opencv4 is not installed for vcpkg triplet x64-windows-static-md, Could not find library in Vcpkg tree package opencv3 is not installed for vcpkg triplet x64-windows-static-md

twistedfall avatar Jan 10 '25 21:01 twistedfall

me too :(

~ >cargo install tplay
    Updating crates.io index
  Installing tplay v0.6.0
    Updating crates.io index
     Locking 358 packages to latest compatible versions
      Adding opencv v0.93.7 (available: v0.94.0)
   Compiling opencv v0.93.7
error: failed to run custom build command for `opencv v0.93.7`

Caused by:
  process didn't exit successfully: `E:\Rust\cargo\target\release\build\opencv-b1378a9ec8077e33\build-script-build` (exit code: 1)
  --- stdout
  cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_4)
  cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_34)
  cargo:rustc-check-cfg=cfg(ocvrs_opencv_branch_32)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_alphamat)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_aruco)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_aruco_detector)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_barcode)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_bgsegm)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_bioinspired)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_calib3d)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_ccalib)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_core)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudaarithm)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudabgsegm)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudacodec)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudafeatures2d)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudafilters)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudaimgproc)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudaobjdetect)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudaoptflow)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudastereo)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cudawarping)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_cvv)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_dnn)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_dnn_superres)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_dpm)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_face)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_features2d)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_flann)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_freetype)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_fuzzy)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_gapi)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_hdf)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_hfs)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_highgui)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_img_hash)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_imgcodecs)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_imgproc)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_intensity_transform)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_line_descriptor)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_mcc)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_ml)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_objdetect)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_optflow)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_ovis)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_phase_unwrapping)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_photo)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_plot)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_quality)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_rapid)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_rgbd)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_saliency)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_sfm)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_shape)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_signal)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_stereo)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_stitching)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_structured_light)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_superres)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_surface_matching)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_text)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_tracking)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_video)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_videoio)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_videostab)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_viz)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_wechat_qrcode)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_xfeatures2d)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_ximgproc)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_xobjdetect)
  cargo:rustc-check-cfg=cfg(ocvrs_has_module_xphoto)
  cargo:rerun-if-env-changed=OPENCV4_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENCV4_STATIC
  cargo:rerun-if-env-changed=OPENCV4_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=OPENCV4_STATIC
  cargo:rerun-if-env-changed=OPENCV4_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=OPENCV_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENCV_STATIC
  cargo:rerun-if-env-changed=OPENCV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=OPENCV_STATIC
  cargo:rerun-if-env-changed=OPENCV_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  === Crate version: 0.93.7
  === 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("E:\\vcpkg\\installed")
  ===   VCPKG_ROOT = None
  ===   VCPKGRS_DYNAMIC = None
  ===   VCPKGRS_TRIPLET = None
  ===   OCVRS_DOCS_GENERATE_DIR = None
  ===   DOCS_RS = None
  ===   PATH = Some("E:\\Rust\\cargo\\target\\release\\deps;E:\\Rust\\cargo\\target\\release;C:\\Users\\steve02081504\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib;C:\\Users\\steve02081504\\.cargo\\bin;E:\\PowerShell\\7;C:\\WINDOWS;C:\\WINDOWS\\system32;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;E:\\Python\\;E:\\Python\\Scripts\\;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files (x86)\\Windows Kits\\10\\Microsoft Application Virtualization\\Sequencer\\;E:\\VS Code\\bin;E:\\Java\\jdk-21.0.2\\bin;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files (x86)\\ZeroTier\\One\\;E:\\nodejs\\;E:\\PowerShell\\7\\;E:\\CMake\\bin;E:\\rust\\cargo\\bin;E:\\Python\\Scripts\\;E:\\Python\\;C:\\Users\\steve02081504\\AppData\\Local\\Microsoft\\WindowsApps;E:\\tools\\upx;E:\\GitHubDesktop\\app-3.4.12\\resources\\app\\git\\mingw64\\bin;E:\\msys\\usr\\bin;C:\\Users\\steve02081504\\workstation\\esh\\path;E:\\tools\\Notepad++;E:\\tools\\pinga;E:\\tools\\waifu2x-ncnn-vulkan-20220728-windows;E:\\mimikatz\\x64;E:\\LLVM\\bin;E:\\VLC;E:\\vcpkg;D:\\Steam;E:\\QQ\\Bin;E:\\LibreOffice\\program;E:\\Discord;E:\\Telegram Desktop;E:\\tools;E:\\RegistryFinder;D:\\Doki Doki Literature Club MAS\\path;E:\\ssp;E:\\;E:\\GitHubDesktop\\bin;E:\\.net\\Confuser;C:\\Users\\steve02081504\\.dotnet\\tools;E:\\aria2;E:\\ffmpeg\\bin;E:\\tools\\hashcat-6.2.6;C:\\Users\\steve02081504\\.dotnet\\tools;C:\\Users\\steve02081504\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\steve02081504\\AppData\\Roaming\\npm;E:\\tools\\qpdf\\bin;C:\\Users\\steve02081504\\.dotnet\\tools;E:\\Firefox;C:\\Users\\steve02081504\\workstation\\fount\\path;C:\\Users\\steve02081504\\.dotnet\\tools;E:\\bflat;C:\\Users\\steve02081504\\.dotnet\\tools")
  === Enabled features:
  ===   CLANG_RUNTIME
  ===   IMGPROC
  ===   VIDEOIO
  === Detected probe priority boost based on environment vars: pkg_config: true, cmake: false, vcpkg: false
  === Probing the OpenCV library in the following order: environment, pkg_config, cmake, vcpkg_cmake, vcpkg
  === Can't probe using: environment, continuing with other methods because: Some environment variables are missing
  === Probing OpenCV library using pkg_config
  === Can't probe using: pkg_config, continuing with other methods because: Could not run `PKG_CONFIG_PATH=E:\vcpkg\installed PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags opencv4`
  The pkg-config command could not be found.

  Most likely, you need to install a pkg-config package for your OS.

  If you've already installed it, ensure the pkg-config command is one of the
  directories in the PATH environment variable.

  If you did not expect this build to link to a pre-installed system library,
  then check documentation of the opencv crate for an option to
  build the library from source, or disable features or dependencies
  that require pkg-config., Could not run `PKG_CONFIG_PATH=E:\vcpkg\installed PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags opencv`
  The pkg-config command could not be found.

  Most likely, you need to install a pkg-config package for your OS.

  If you've already installed it, ensure the pkg-config command is one of the
  directories in the PATH environment variable.

  If you did not expect this build to link to a pre-installed system library,
  then check documentation of the opencv crate for an option to
  build the library from source, or disable features or dependencies
  that require pkg-config.
  === Probing OpenCV library using cmake
  === cmake ninja probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Release" "-G" "Ninja"
  === Probing with cmake ninja generator failed, will try Makefile generator, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Ninja\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake makefiles probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix Makefiles"
  === Probing with cmake Makefile generator failed, will try deprecated find_package, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Unix Makefiles\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake find-package compile probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_BUILD_TYPE=Release" "--find-package" "-DCOMPILER_ID=GNU" "-DLANGUAGE=CXX" "-DMODE=COMPILE" "-DNAME=OpenCV"
  === Can't probe using: cmake, continuing with other methods because: cmake returned an error
      stdout: "OpenCV not found.\r\n"
      stderr: "CMake Error: Run 'cmake --help' for all supported options.\n"
  === Probing OpenCV library using vcpkg_cmake
  === Discovered vcpkg root: E:\vcpkg
  === Probing OpenCV library using cmake with toolchain: E:\vcpkg\scripts/buildsystems/vcpkg.cmake
  === cmake ninja probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=E:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Release" "-G" "Ninja"
  === Probing with cmake ninja generator failed, will try Makefile generator, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Ninja\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake makefiles probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=E:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Release" "-G" "Unix Makefiles"
  === Probing with cmake Makefile generator failed, will try deprecated find_package, error: cmake returned an error
      stdout: "-- Configuring incomplete, errors occurred!\n"
      stderr: "CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):\n  Compatibility with CMake < 3.10 will be removed from a future version of\n  CMake.\n\n  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax\n  to tell CMake that the project requires at least <min> but has been updated\n  to work with policies introduced by <max> or earlier.\n\n\nCMake Error: CMake was unable to find a build program corresponding to \"Unix Makefiles\".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.\nCMake Error: CMAKE_C_COMPILER not set, after EnableLanguage\nCMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage\n"
  === cmake find-package compile probe command: "cmake" "-S" "C:\\Users\\steve02081504\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\opencv-0.93.7\\cmake" "-DOCVRS_PACKAGE_NAME=OpenCV" "-DCMAKE_TOOLCHAIN_FILE=E:\\vcpkg\\scripts/buildsystems/vcpkg.cmake" "-DCMAKE_BUILD_TYPE=Release" "--find-package" "-DCOMPILER_ID=GNU" "-DLANGUAGE=CXX" "-DMODE=COMPILE" "-DNAME=OpenCV"
  === Can't probe using: vcpkg_cmake, continuing with other methods because: cmake returned an error
      stdout: "OpenCV not found.\r\n"
      stderr: "CMake Error at E:/CMake/share/cmake-3.31/Modules/FindThreads.cmake:66 (message):\n  FindThreads only works if either C or CXX language is enabled\nCall Stack (most recent call first):\n  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)\n  E:/CMake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)\n  E:/vcpkg/installed/x64-windows/share/absl/abslConfig.cmake:4 (find_dependency)\n  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)\n  E:/vcpkg/installed/x64-windows/share/protobuf/protobuf-config.cmake:7 (find_package)\n  E:/vcpkg/installed/x64-windows/share/protobuf/vcpkg-cmake-wrapper.cmake:3 (_find_package)\n  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)\n  E:/CMake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)\n  E:/vcpkg/installed/x64-windows/share/opencv4/OpenCVModules.cmake:19 (find_dependency)\n  E:/vcpkg/installed/x64-windows/share/opencv4/OpenCVConfig.cmake:126 (include)\n  E:/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)\n  E:/CMake/share/cmake-3.31/Modules/CMakeFindPackageMode.cmake:182 (find_package)\n\n\nCMake Error: Run 'cmake --help' for all supported options.\n"
  === Probing OpenCV library using vcpkg
  === Can't probe using: vcpkg, continuing with other methods because: Could not find library in Vcpkg tree package opencv4 is not installed for vcpkg triplet x64-windows-static-md, Could not find library in Vcpkg tree package opencv3 is not installed for vcpkg triplet x64-windows-static-md
  Error: "Failed to find installed OpenCV package using probes: environment, pkg_config, cmake, vcpkg_cmake, vcpkg, refer to https://github.com/twistedfall/opencv-rust#getting-opencv for help"
error: failed to compile `tplay v0.6.0`, intermediate artifacts can be found at `E:\Rust\cargo\target`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
~ >

steve02081504 avatar Jan 12 '25 03:01 steve02081504

Here how I fixed this

  • Remove vcpkg
  • Install Chocolaty and after that use choco to install llvm
  • Download opencv release from official repo
  • Set PATH as shown in screenshot

Image

  • Add C:\tools\opencv\build\x64\vc16\bin to Path
  • and most important restart your system

prabhat0206 avatar Feb 20 '25 18:02 prabhat0206

Windows下Rust配置Opencv开发环境

Setting up the Opencv development environment for Rust on Windows10

1.安装LLVM

Install LLVM

LLVM-17.0.6-win64.exe

手动下载 LLVM 将LLVM添加系统环境变量 path

Manually download LLVM and add LLVM to the system environment variable path.

G:\CV\LLVM\bin

G:\CV\LLVM\lib

2.安装CMake

install CMake

cmake-3.26.0-windows-x86_64.msi

将CMake添加系统环境变量 path

Add CMake to the system environment variable path

G:\CV\CMake\bin

3.手动安装Opencv

将opencv添加系统环境变量 path

opencv-4.11.0-windows.exe

Manually download Opencvand add Opencvto the system environment variable path.

%OPENCV_DIR%\x64\vc16\lib

%OPENCV_DIR%\x64\vc16\bin

创建opencv系统变量

Create OpenCV system variables

OPENCV_DIR=G:\CV\opencv\build

OPENCV_INCLUDE_PATHS=G:\CV\opencv\build\include

OPENCV_LIB_DIR=G:\CV\opencv\build\x64\vc16\lib

OPENCV_LINK_LIBS=opencv_world4110

OPENCV_LINK_PATHS=G:\CV\opencv\build\x64\vc16\lib

--Replace with your own path

sttufe avatar May 10 '25 05:05 sttufe