vcpkg错误分析方法
最近在使用vcpkg时,经常会碰到CMake错误。 有些以前能编译通过的包, 过一段时间又不能编译错误了。 错误提示一般是CMake错误, 弄得很郁闷。
我采用以下步骤解决了问题:
- 分析错误
- 查看错误日志
- 查看cmake文件
- 手工处理错误
下面是我opencv编译错误解决过程:
1. 执行vcpkg命令
PS D:\Develop\GitOthers\vcpkg> ./vcpkg install opencv
2. 错误信息
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:43 (message):
......
See logs for more information: D:\Develop\GitOthers\vcpkg\buildtrees\opencv\config-x64-windows-rel-out.log D:\Develop\GitOthers\vcpkg\buildtrees\opencv\config-x64-windows-rel-err.log Call Stack (most recent call first): scripts/cmake/vcpkg_configure_cmake.cmake:170 (vcpkg_execute_required_process) ports/opencv/portfile.cmake:36 (vcpkg_configure_cmake) scripts/ports.cmake:72 (include) Error: Building package opencv:x64-windows failed with: BUILD_FAILED Please ensure you're using the latest portfiles with `.\vcpkg update`, then submit an issue at https://github.com/Microsoft/vcpkg/issues including: Package: opencv:x64-windows Vcpkg version: 0.0.81-fd9b73987bf215f1d10acf4207c3cc637a1bcf2c Additionally, attach any relevant sections from the log files above.
3. 查看错误日志(XXX-err.log)
CMake Warning at 3rdparty/ippicv/downloader.cmake:56 (message): ICV: Local copy of ICV package has invalid MD5 hash: 0d1682bf35ca5cd296a7cc795d30ecc8 (expected: 04e81ce5d0e329c3fbc606ae32cad44d) Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:110 (_icv_downloader) cmake/OpenCVFindIPP.cmake:243 (include) cmake/OpenCVFindLibsPerf.cmake:37 (include) CMakeLists.txt:564 (include) CMake Error at 3rdparty/ippicv/downloader.cmake:73 (file): file DOWNLOAD HASH mismatch for file: [D:/Develop/GitOthers/vcpkg/buildtrees/opencv/src/opencv-3.2.0/3rdparty/ippicv/downloads/windows-04e81ce5d0e329c3fbc606ae32cad44d/ippicv_windows_20151201.zip] expected hash: [04e81ce5d0e329c3fbc606ae32cad44d] actual hash: [57ed63670f6763ece0d789f9cb52d952] status: [28;"Timeout was reached"] Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:110 (_icv_downloader) cmake/OpenCVFindIPP.cmake:243 (include) cmake/OpenCVFindLibsPerf.cmake:37 (include) CMakeLists.txt:564 (include) CMake Error at 3rdparty/ippicv/downloader.cmake:77 (message): ICV: Failed to download ICV package: ippicv_windows_20151201.zip. Status=28;"Timeout was reached" Call Stack (most recent call first): 3rdparty/ippicv/downloader.cmake:110 (_icv_downloader) cmake/OpenCVFindIPP.cmake:243 (include) cmake/OpenCVFindLibsPerf.cmake:37 (include) CMakeLists.txt:564 (include)
查看日志, 发现原来是有个文件下载不完整, 造成了后续操作无法完成。
4. 如何解决问题呢?
查看opencv-3.2.0\3rdparty\ippicv\downloader.cmake文件,找到相应的下载文件,手动下载 ippicv_windows_20151201.zip
下载完成后,将文件复制到 D:/Develop/GitOthers/vcpkg/buildtrees/opencv/src/opencv-3.2.0/3rdparty/ippicv/downloads/windows-04e81ce5d0e329c3fbc606ae32cad44d/ippicv_windows_20151201.zip
然后再次执行vcpkg编译命令