配置 OpenCV 时 Cmake 失败

配置 OpenCV 时 Cmake 失败

我正在尝试构建 OpenCV 并在 Qt 中使用它。我已经安装了 OpenCV 和 Qt 所需的所有软件包,之后我尝试运行cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local /media/d/Install/opencv-2.4.8但出现错误:

CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:189 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- The CXX compiler identification is GNU 4.8.2
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:185 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- The C compiler identification is GNU 4.8.2
CMake Error at /usr/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:186 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:71 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:78 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:56 (project)


CMake Error at CMakeLists.txt:70 (message):
  CMake fails to deterimine the bitness of target platform.

    Please check your CMake and compiler installation. If you are crosscompiling then ensure that your CMake toolchain file correctly sets the compiler details.


-- Configuring incomplete, errors occurred!

CMakeLists.txt:56:

project(OpenCV CXX C)

/usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:189:

configure_file(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
                ${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake
                IMMEDIATE @ONLY)

答案1

我通过删除之前启动 cmake 但在安装过程中取消的构建文件夹解决了此问题。现在它可以正常工作了。

相关内容