使用CMAGE失败升级到McOS Calalina的OpenCV4 C++构建

使用CMAGE失败升级到McOS Calalina的OpenCV4 C++构建,c++,cmake,macos-catalina,opencv4,C++,Cmake,Macos Catalina,Opencv4,嗨,我正在尝试使用cmake从源代码构建opencv4。我将macOS更新到10.15并安装了最新的xcode。我使用git克隆存储库并创建一个构建目录,如下所示,然后尝试配置cmake: $ mkdir opencv $ cd opencv $ git clone https://github.com/opencv/opencv.git $ cd opencv $ git checkout tags/4.2.0 $ cd .. $ git clone https://github.com/op

嗨,我正在尝试使用cmake从源代码构建opencv4。我将macOS更新到10.15并安装了最新的xcode。我使用git克隆存储库并创建一个构建目录,如下所示,然后尝试配置cmake:

$ mkdir opencv
$ cd opencv
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
$ git checkout tags/4.2.0
$ cd ..
$ git clone https://github.com/opencv/
$ cd opencv_contrib 
$ git checkout tags/4.2.0
$ cd ..


$ cd build_opencv
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=../install \
      -D INSTALL_C_EXAMPLES=ON \
      -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
      -D BUILD_EXAMPLES=ON ../opencv
我得到以下错误,它似乎试图找到这个不存在的路径:

/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework

我已经将我的mac版本更新为10.15,但它似乎正在MacOSX10.14下搜索路径。我在网上看过,但似乎找不到任何建议

CMake Error in /usr/local/include/opencv/build_opencv/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "VTK::RenderingOpenGL2" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in /usr/local/include/opencv/build_opencv/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "VTK::RenderingOpenGL2" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in /usr/local/include/opencv/build_opencv/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Imported target "VTK::RenderingOpenGL2" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error at cmake/OpenCVDetectVTK.cmake:73 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:767 (include)


-- Configuring incomplete, errors occurred!
下载并安装

用于XCode 12的命令行工具


以前,您可以执行xcode select-install,它可以为您执行,但是,现在出现了一个错误,它说找不到包或类似的东西。因此,必须采用这种方法。

安装XCode和安装XCode CLT是两项不同的任务。你两个都做了吗?在升级到Catalina之前,你有没有制作过这个?如果是这样,你需要摆脱旧的安装文件夹,从头开始。您是否检查了openCV的要求以及它支持什么?我在升级到Catalina后安装了Xcode和Xcode CLT。我还检查了需求并安装了必要的先决条件。我只是不知道为什么它还在macOS10.14下寻找路径?您的意思是删除opencv的安装文件夹并重新开始吗?