Skip to content

windows 上编译cpp_infer 文档不对,无法正常generate 生成vs solution(至少我电脑上一步步安装不对) #17531

@aijyo

Description

@aijyo

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

CMake GUI 按照文档一步步操作(我甚至放弃了我vcpkg 安装的opencv),最后generate 的时候疯狂报错:OpenCV STATIC: OFF
CMake Warning at D:/3rd/opencv/sources/build/install/OpenCVConfig.cmake:190 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:58 (find_package)

CMake Error at CMakeLists.txt:58 (find_package):
Found package configuration file:

D:/3rd/opencv/sources/build/install/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.

Image

最后解决方案是(也就是OPENCV_DIR OpenCV_DIR 是两个不一样的值,但是文档是一样的)
cmake -S . -B build -DOPENCV_DIR=D:/3rd/opencv/sources/build/install
-DOpenCV_DIR=D:/3rd/opencv/sources/build/install/lib/cmake/opencv4 `
-DPADDLE_LIB=D:/3rd/paddle_inference

(我又复现了一遍,本质是ppocr cmakelist set(OpenCV_DIR "${OPENCV_DIR}/x64/vc16/lib") 这一行逻辑不对,OpenCV lib的dir可能不是这个,比如我电脑VS 编出来的第一次在:build/install/lib/cmake/opencv4 第二次在:build\install\lib ,只能改cmakelists才能generate 过

🏃‍♂️ Environment (运行环境)

OS windows 10
Env visual studio 2022
Cmake 4.2.1

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

按照文档一步步来就可复现:Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtask/deploymentRelated to service deployment or serving.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions