microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.11k stars 6.37k forks source link

[opencv] build failure #27865

Closed longlongvip closed 1 year ago

longlongvip commented 1 year ago

Host Environment

To Reproduce ./vcpkg install opencv:x64-windows

Failure logs

Computing installation plan...
The following packages will be built and installed:
    opencv[core,default-features]:x64-windows -> 4.6.0
  * opencv4[core,default-features,dnn,jpeg,png,quirc,tiff,webp]:x64-windows -> 4.6.0#8
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Restored 0 package(s) from C:\Users\fengyunlong\AppData\Local\vcpkg\archives in 1.515 ms. Use --debug to see more details.
Installing 1/2 opencv4:x64-windows...
Building opencv4[core,default-features,dnn,jpeg,png,quirc,tiff,webp]:x64-windows...
-- Using cached opencv-opencv-4.6.0-1.tar.gz.
-- Cleaning sources at D:/SexDevTools/vcpkg/buildtrees/opencv4/src/4.6.0-9a95a1b699.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source D:/SexDevTools/vcpkg/downloads/opencv-opencv-4.6.0-1.tar.gz
-- Applying patch 0001-disable-downloading.patch
-- Applying patch 0002-install-options.patch
-- Applying patch 0003-force-package-requirements.patch
-- Applying patch 0004-fix-eigen.patch
-- Applying patch 0005-fix-policy-CMP0057.patch
-- Applying patch 0006-fix-uwp.patch
-- Applying patch 0008-devendor-quirc.patch
-- Applying patch 0009-fix-protobuf.patch
-- Applying patch 0010-fix-uwp-tiff-imgcodecs.patch
-- Applying patch 0011-remove-python2.patch
-- Applying patch 0012-fix-zlib.patch
-- Applying patch 0015-fix-freetype.patch
-- Applying patch 0017-mingw-strsafe-no-deprecate.patch
-- Using source at D:/SexDevTools/vcpkg/buildtrees/opencv4/src/4.6.0-9a95a1b699.clean
-- Using cached opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz.
-- Found external ninja('1.10.2').
-- Configuring x64-windows
-- Building x64-windows-dbg
CMake Warning at scripts/cmake/vcpkg_execute_build_process.cmake:62 (message):
  Please ensure your system has sufficient memory.
Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/opencv4/portfile.cmake:452 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

-- Restarting build without parallelism
-- Building x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:131 (message):
    Command failed: D:/SexDevTools/cmake/bin/cmake.exe --build . --config Release --target install -- -v -j17
    Working Directory: D:/SexDevTools/vcpkg/buildtrees/opencv4/x64-windows-rel
    See logs for more information:
      D:\SexDevTools\vcpkg\buildtrees\opencv4\install-x64-windows-rel-out.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/opencv4/portfile.cmake:452 (vcpkg_cmake_install)
  scripts/ports.cmake:147 (include)

error: building opencv4:x64-windows failed with: BUILD_FAILED
error: Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
    https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+opencv4
You can submit a new issue at:
    https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[opencv4]+Build+error
Include '[opencv4] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.
    vcpkg-tool version: 2022-11-10-5fdee72bc1fceca198fb1ab7589837206a8b81ba
    vcpkg-scripts version: 3776224fd 2022-11-17 (16 minutes ago)
JonLiu1993 commented 1 year ago

@longlongvip, Thanks for poting this issue, please follow the steps then try again:

  1. Ensure your disk has enough space.
  2. Close your anti-virus.
timmeh87 commented 1 year ago

CMake Warning at scripts/cmake/vcpkg_execute_build_process.cmake:62 (message): Please ensure your system has sufficient memory.

I have seen this before, if you are in a VM or something try doubling the ram, if you cant double the ram then reduce the number of CPU cores

dg0yt commented 1 year ago

There is also:

-- Restarting build without parallelism

If this fails, there is nothing to be gained from reducing the number of (used) CPU cores.

longlongvip commented 1 year ago
longlongvip commented 1 year ago

The reason for the previous compilation failure may be caused by insufficient memory