twistedfall / opencv-rust

Rust bindings for OpenCV 3 & 4
MIT License
1.93k stars 152 forks source link

setup enviroment fail #495

Closed adminSxs closed 5 months ago

adminSxs commented 1 year ago

Os: win10 22H2

env setup VCPKG_ROOT VCPKGRS_DYNAMIC

in rust project log ( RUST_BACKTRACE=full cargo build -vv ):

cargo.toml

opencv = "0.84.5"
 RUST_BACKTRACE=full cargo build -vv                           
       Fresh glob v0.3.1                                                       
       Fresh memchr v2.6.3                                                     
       Fresh regex-syntax v0.7.5                                               
       Fresh dunce v1.0.4                                                      
       Fresh jobserver v0.1.26                                                 
       Fresh autocfg v1.1.0                                                    
       Fresh once_cell v1.18.0                                                 
       Fresh percent-encoding v2.3.0                                           
       Fresh shlex v1.2.0                                                      
       Fresh vcpkg v0.2.15                                                     
       Fresh pkg-config v0.3.27                                                
       Fresh aho-corasick v1.0.5                                               
       Fresh cc v1.0.79                                                        
       Fresh libc v0.2.147                                                     
       Fresh regex-automata v0.3.8                                             
       Fresh semver v1.0.18                                                    
       Fresh clang-sys v1.6.1                                                  
       Fresh regex v1.9.5                                                      
       Fresh num-traits v0.2.16                                                
       Fresh clang v2.0.0                                                      
       Fresh opencv-binding-generator v0.72.0                                  
       Fresh opencv v0.84.5                                                    
       Dirty opencv4 v0.1.0 (D:\projects\rust\opencv4): dependency info changed
   Compiling opencv4 v0.1.0 (D:\projects\rust\opencv4)                         
     Running `set CARGO='\\?\D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\cargo.exe'&& set CARGO_BIN_NAME=opencv4&& set CARGO_CRATE_NAME=opencv4&& set CARGO_MANIFEST
_DIR='D:\projects\rust\opencv4'&& set CARGO_PKG_AUTHORS=''&& set CARGO_PKG_DESCRIPTION=''&& set CARGO_PKG_HOMEPAGE=''&& set CARGO_PKG_LICENSE=''&& set CARGO_PKG_LICENSE_FILE=''&& set C
ARGO_PKG_NAME=opencv4&& set CARGO_PKG_README=''&& set CARGO_PKG_REPOSITORY=''&& set CARGO_PKG_RUST_VERSION=''&& set CARGO_PKG_VERSION=0.1.0&& set CARGO_PKG_VERSION_MAJOR=0&& set CARGO_
PKG_VERSION_MINOR=1&& set CARGO_PKG_VERSION_PATCH=0&& set CARGO_PKG_VERSION_PRE=''&& set CARGO_PRIMARY_PACKAGE=1&& set PATH='D:\projects\rust\opencv4\target\debug\deps;D:\software\rust
up\toolchains\stable-x86_64-pc-windows-msvc\bin;D:\software\rustup\toolchains\stable-x86_64-pc-windows-msvc\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\z
haobo\bin;D:\software\vmware16\bin\;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Lapce\;C:\Windows\syst
em32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files\Git LFS;C:
\Program Files\dotnet\;D:\software\LLVM\bin;D:\software\maven\bin;D:\software\Microsoft VS Code\bin;D:\software\toolbox\scripts;D:\software\anaconda3;D:\software\anaconda3\Scripts;D:\s
oftware\anaconda3\Library\bin;D:\software\anaconda3\Library\usr\bin;D:\software\anaconda3\Library\mingw-w64\bin;D:\software\vcpkg;D:\software\nodejs;C:\Program Files\Git\bin;C:\Users\z
haobo\AppData\Local\Microsoft\WindowsApps;D:\software\sonar-scanner\bin;D:\software\Huawei\DevEco Studio\bin;D:\software\java11\bin;D:\software\qemu;D:\software\curl-8.1.0_1-win64-ming
w\bin;C:\Users\zhaobo\.dotnet\tools;D:\software\vcpkg\installed\x64-windows\lib;D:\software\vcpkg\installed\x64-windows\bin;D:\software\scrcpy-win64-v2.0;C:\Users\zhaobo\.azure-kubectl
;D:\software\cargo\bin;D:\software\rustup\bin;D:\software\opencv\opencv\build\x64\vc16\bin;D:\software\cmake\bin'&& rustc --crate-name opencv4 --edition=2021 'src\main.rs' --error-form
at=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=183 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=c1bc8a304b
07e037 --out-dir 'D:\projects\rust\opencv4\target\debug\deps' -C 'incremental=D:\projects\rust\opencv4\target\debug\incremental' -L 'dependency=D:\projects\rust\opencv4\target\debug\de
ps' --extern 'opencv=D:\projects\rust\opencv4\target\debug\deps\libopencv-5c9707fab3c58fc3.rlib' -L 'native=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.
32822\atlmfc\lib\x64' -L 'native=D:\projects\rust\opencv4\target\debug\build\opencv-d6efdcbea4dc2169\out' -L 'D:/software/vcpkg/installed/x64-windows/debug/lib'`
warning: unused variable: `mat`
 --> src\main.rs:5:9
  |
5 |     let mat = imread("D:/a.png",0)?;
  |         ^^^ help: if this is intentional, prefix it with an underscore: `_mat`
  |
  = note: `#[warn(unused_variables)]` on by default

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\zhaobo\\AppData\\Local\\Temp\\r
ustcnYHOAf\\symbols.o" "D:\\projects\\rust\\opencv4\\target\\debug\\deps\\opencv4.122qfe6orfhddn92.rcgu.o" "D:\\projects\\rust\\opencv4\\target\\debug\\deps\\opencv4.1bw8fscjpr9ovbj6.r
cgu.o" "D:\\projects\\rust\\opencv4\\target\\debug\\deps\\opencv4.1f70kzxz8zybgqlo.rcgu.o" "D:\\projects\\rust\\opencv4\\target\\debug\\deps\\opencv4.1mzdf6x330gi0502.rcgu.o" "D:\\proj
ects\\rust\\opencv4\\target\\debug\\deps\\opencv4.1plwcs1zjnl30ab9.rcgu.o" "D:\\projects\\rust\\opencv4\\target\\debug\\deps\\opencv4.1ux16q8l4f0vph3t.rcgu.o" "D:\\projects\\rust\\open
cv4\\target\\debug\\deps\\opencv4.3brlc3msybz7hl8i.rcgu.o" 

....

log.txt

twistedfall commented 1 year ago

Can you please run a cargo clean and then do a cargo build -vv again and attach the output?

adminSxs commented 1 year ago

Can you please run a cargo clean and then do a cargo build -vv again and attach the output?

log.txt

twistedfall commented 1 year ago

The log has a lot of Fresh <cratename> so it doesn't look like a clean build

adminSxs commented 1 year ago

The log has a lot of Fresh <cratename> so it doesn't look like a clean build when i create new project and add opencv crate,show same error log

twistedfall commented 1 year ago

This log doesn't contain the debug output that the build script of the opencv crate produces during its build. Maybe you have some kind of target directory sharing or caching?

adminSxs commented 1 year ago

This log doesn't contain the debug output that the build script of the opencv crate produces during its build. Maybe you have some kind of target directory sharing or caching?

i'm reinstall rust, still same error

adminSxs commented 1 year ago

This log doesn't contain the debug output that the build script of the opencv crate produces during its build. Maybe you have some kind of target directory sharing or caching?

project structure

image image

arihant2math commented 11 months ago

Perhaps you could delete the target/ directory, re-run cargo build -vv and post the logs here?