Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocr-api-20210707在CMake时发生错误:CMake Generate step failed. Build files cannot be regenerated correctly. #11

Open
lanzheng1113 opened this issue Apr 19, 2023 · 0 comments

Comments

@lanzheng1113
Copy link

lanzheng1113 commented Apr 19, 2023

操作系统:Window 10 (19045.2846)
CMake版本:3.21.2
开发工具: Microsoft Visual Studio Enterprise 2015 版本 14.0.24720.00 Update 1


按照ocr-api-20210707\README-CN.md中的说明,用vcpkg(vcpkg安装在D:/github/vcpkg)执行了:
vcpkg install boost openssl-windows cpprestsdk
结果为:
D:\github\vcpkg>vcpkg install boost cpprestsdk openssl-windows
warning: Starting with the September 2023 release, the default triplet for vcpkg libraries will change from x86-windows to the detected host triplet (x64-windows). To resolve this message, add --triplet x86-windows to keep the same behavior.
Computing installation plan...
The following packages are already installed:
boost[core]:x86-windows -> 1.82.0#1
cpprestsdk[brotli,compression,core,default-features]:x86-windows -> 2.10.18#2
openssl-windows[core]:x86-windows -> deprecated
boost:x86-windows is already installed
cpprestsdk:x86-windows is already installed
openssl-windows:x86-windows is already installed
Restored 0 package(s) from C:\Users\Administrator\AppData\Local\vcpkg\archives in 157 us. Use --debug to see more details.
Total install time: 2.38 ms
cpprestsdk provides CMake targets:

# this is heuristically generated, and may not be correct
find_package(cpprestsdk CONFIG REQUIRED)
target_link_libraries(main PRIVATE cpprestsdk::cpprest cpprestsdk::cpprestsdk_zlib_internal cpprestsdk::cpprestsdk_brotli_internal)

继续按照EADME-CN.md,并参照vcpkg的说明,使用“VS2015 开发人员命令提示”执行以下命令:
D:\github\alibabacloud-cpp-sdk\ocr-api-20210707>cd cmake_build
D:\github\alibabacloud-cpp-sdk\ocr-api-20210707\cmake_build>cmake .. -G "Visual Studio 14" -DCMAKE_TOOLCHAIN_FILE=D:/github/vcpkg/scripts/buildsystems/vcpkg.cmake

结果为:
-- alibabacloud_open_api : Project will be installed to C:/Program Files (x86)/alibabacloud_ocr_api_20210707
-- Installing LIB components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\lib
-- Installing BIN components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\bin
-- Installing INCLUDE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\include
-- Installing CMAKE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\CMake
-- alibabacloud_open_api_util could not be located, Building alibabacloud_open_api_util instead.
-- alibabacloud_endpoint_util could not be located, Building alibabacloud_endpoint_util instead.
-- Added alibabacloud_endpoint_util source : D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_alibabacloud_endpoint_util-src
-- Added alibabacloud_endpoint_util binary : D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_alibabacloud_endpoint_util-build
C++ compiler flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc -std=c++11 -std=c++11
-- The C++ compiler ID is: MSVC
-- The C++ compiler version is: 19.0.23506.0
-- Build type: Release
-- Install libraries
-- alibabacloud_endpoint_util : Project will be installed to C:/Program Files (x86)/alibabacloud_ocr_api_20210707
-- Installing LIB components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\lib
-- Installing BIN components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\bin
-- Installing INCLUDE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\include
-- Installing CMAKE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\CMake
-- darabonba_core could not be located, Building darabonba_core instead.
CMake Warning at C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1354 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1477 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:2087 (_Boost_MISSING_DEPENDENCIES)
D:/github/vcpkg/installed/x86-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
D:/github/vcpkg/scripts/buildsystems/vcpkg.cmake:806 (include)
CMakeLists.txt:46 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1354 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1477 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:2087 (_Boost_MISSING_DEPENDENCIES)
D:/github/vcpkg/installed/x86-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
D:/github/vcpkg/scripts/buildsystems/vcpkg.cmake:806 (include)
CMakeLists.txt:46 (find_package)

......
..... 这里省略部分类似的CMake Warning
......

CMake Warning at C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1354 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1477 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:2087 (_Boost_MISSING_DEPENDENCIES)
D:/github/vcpkg/installed/x86-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
D:/github/vcpkg/scripts/buildsystems/vcpkg.cmake:806 (include)
CMakeLists.txt:46 (find_package)
CMake Warning at C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1354 (message):
New Boost version may have incorrect or missing dependencies and imported
targets
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:1477 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files/CMake/share/cmake-3.21/Modules/FindBoost.cmake:2087 (_Boost_MISSING_DEPENDENCIES)
D:/github/vcpkg/installed/x86-windows/share/boost/vcpkg-cmake-wrapper.cmake:11 (_find_package)
D:/github/vcpkg/scripts/buildsystems/vcpkg.cmake:806 (include)
CMakeLists.txt:46 (find_package)

-- alibabacloud_ocr_api_20210707 : Project will be installed to C:/Program Files (x86)/alibabacloud_ocr_api_20210707
-- Installing LIB components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\lib
-- Installing BIN components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\bin
-- Installing INCLUDE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\include
-- Installing CMAKE components to C:\Program Files (x86)\alibabacloud_ocr_api_20210707\CMake
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CPPREST_LIB

linked by target "alibabacloud_ocr_api_20210707" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707
linked by target "darabonba_util" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_darabonba_util-src
linked by target "darabonba_core" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_darabonba_core-src
linked by target "alibabacloud_open_api" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_alibabacloud_open_api-src
linked by target "alibabacloud_credential" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_alibabacloud_credential-src
linked by target "alibabacloud_open_api_util" in directory D:/github/alibabacloud-cpp-sdk/ocr-api-20210707/cmake_build/_deps/_alibabacloud_open_api_util-src

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.

看起来貌似是CMake没有找到CPPREST_LIB(boost库能找到但是有警告),这里有什么解决办法吗?
是否对开发工具版本,或者CMake版本有其他要求?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant