cmake_minimum_required(VERSION 3.29)
# Enable vcpkg manifest mode
if(DEFINED ENV{VCPKG_ROOT})
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
# Set a suitable triplet for Linux (adjust if using a different architecture)
set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "")
endif()
project(opencv_app)
# Enable C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "Using vcpkg toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
message(STATUS "Using vcpkg triplet: ${VCPKG_TARGET_TRIPLET}")
# Add executable
add_executable(opencv_app main.cpp)
# Find OpenCV package via vcpkg
find_package(OpenCV REQUIRED)
target_link_libraries(opencv_app PRIVATE ${OpenCV_LIBS})
target_include_directories(opencv_app PRIVATE ${OpenCV_INCLUDE_DIRS})
< /code>
и vcpkg.json is: < /p>
{
"name": "opencv-app",
"version": "0.1.0",
"dependencies": [
{
"name": "opencv",
"default-features": false,
"features": [ "jpeg" ]
}
]
}
< /code>
VCPKG тянет OpenCV и пытается скомпилировать его, но не может закончить эту ошибку: < /p>
nstalling 43/55 libcap:x64-linux@2.73#1...
Building libcap:x64-linux@2.73#1...
-- Using cached libcap-2.73.tar.xz
-- Cleaning sources at /media/r/Data/locals/vcpkg/buildtrees/libcap/src/libcap-2-2049950211.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /media/r/Data/locals/vcpkg/downloads/libcap-2.73.tar.xz
-- Using source at /media/r/Data/locals/vcpkg/buildtrees/libcap/src/libcap-2-2049950211.clean
-- Getting CMake variables for x64-linux
-- Loading CMake variables from /media/r/Data/locals/vcpkg/buildtrees/libcap/cmake-get-vars_C_CXX-x64-linux.cmake.log
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building/Installing x64-linux-dbg
-- Making target 'all' for x64-linux-dbg
-- Making target 'install' for x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
Command failed: /usr/bin/bash -c "CC='/usr/bin/cc' CXX='/usr/bin/c++' CC_FOR_BUILD='/usr/bin/cc' CPP_FOR_BUILD='/usr/bin/cc -E' CXX_FOR_BUILD='/usr/bin/c++' NM='/usr/bin/nm' RC='' WINDRES='' DLLTOOL='CMAKE_DLLTOOL-NOTFOUND' STRIP='/usr/bin/strip' OBJDUMP='/usr/bin/objdump' RANLIB='/usr/bin/ranlib' AR='/usr/bin/ar' LD='/usr/bin/ld' /usr/bin/make V=1 -j 13 --trace -f Makefile.vcpkg install DESTDIR=/media/r/Data/locals/vcpkg/packages/libcap_x64-linux"
Working Directory: /media/r/Data/locals/vcpkg/buildtrees/libcap/x64-linux-dbg
See logs for more information:
/media/r/Data/locals/vcpkg/buildtrees/libcap/make-install-x64-linux-dbg-out.log
/media/r/Data/locals/vcpkg/buildtrees/libcap/make-install-x64-linux-dbg-err.log
Call Stack (most recent call first):
/media/r/Data/CrossCompilation/build/vcpkg_installed/x64-linux/share/vcpkg-make/vcpkg_make.cmake:68 (vcpkg_execute_build_process)
/media/r/Data/CrossCompilation/build/vcpkg_installed/x64-linux/share/vcpkg-make/vcpkg_make_install.cmake:106 (vcpkg_run_shell_as_build)
ports/libcap/portfile.cmake:28 (vcpkg_make_install)
scripts/ports.cmake:206 (include)
error: building libcap:x64-linux failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle libcap:x64-linux: 1.2 s
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+libcap
You can submit a new issue at:
https://github.com/microsoft/vcpkg/issues/new?title=[libcap]+Build+error+on+x64-linux&body=Copy%20issue%20body%20from%20%2Fmedia%2Fr%2FData%2FCrossCompilation%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
-- Running vcpkg install - failed
CMake Error at /media/r/Data/locals/vcpkg/scripts/buildsystems/vcpkg.cmake:941 (message):
vcpkg install failed. See logs for more information:
/media/r/Data/CrossCompilation/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
/opt/cmake-4.1.0/share/cmake-4.1/Modules/CMakeDetermineSystem.cmake:146 (include)
CMakeLists.txt:10 (project)
CMake 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.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Я пытаюсь собрать простое приложение, которое использует OpenCV в Linux: cmakefile.txt следующее: < /p> [code]cmake_minimum_required(VERSION 3.29) # Enable vcpkg manifest mode if(DEFINED ENV{VCPKG_ROOT}) set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
# Set a suitable triplet for Linux (adjust if using a different architecture) set(VCPKG_TARGET_TRIPLET "x64-linux" CACHE STRING "") endif() project(opencv_app)
error: building libcap:x64-linux failed with: BUILD_FAILED See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information. Elapsed time to handle libcap:x64-linux: 1.2 s 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+libcap You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?title=[libcap]+Build+error+on+x64-linux&body=Copy%20issue%20body%20from%20%2Fmedia%2Fr%2FData%2FCrossCompilation%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
-- Running vcpkg install - failed CMake Error at /media/r/Data/locals/vcpkg/scripts/buildsystems/vcpkg.cmake:941 (message): vcpkg install failed. See logs for more information: /media/r/Data/CrossCompilation/build/vcpkg-manifest-install.log Call Stack (most recent call first): /opt/cmake-4.1.0/share/cmake-4.1/Modules/CMakeDetermineSystem.cmake:146 (include) CMakeLists.txt:10 (project)
CMake 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. CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! [/code] В чем проблема и как ее исправить?