C ++如何为vs 2015 x86构建opencv [英] C++ How can I build opencv for vs 2015 x86

查看:51
本文介绍了C ++如何为vs 2015 x86构建opencv的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的VS2015 C ++项目中使用opencv,我完全需要x86平台而不是x64来使用它.我在互联网上到处建议使用CMake.此外,我尝试配置多个版本的opencv-2.4.9;3.0.0;3.1.0在通过CMake进行的每个配置和生成中,我都会遇到很多错误.配置后,这是来自CMake gui的日志:

I want to use opencv in my VS2015 C++ project and I need it exactly for x86 platform, not x64. I used CMake as advised everywhere in the internet. What is more I tried to configure several versions of opencv - 2.4.9; 3.0.0; 3.1.0 And on each configuring and generating through CMake I get a lot of errors. Here's a log from CMake gui after configuring:

CMake Deprecation Warning at CMakeLists.txt:69 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:74 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


The CXX compiler identification is MSVC 19.0.23506.0
The C compiler identification is MSVC 19.0.23506.0
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Performing Test HAVE_CXX_FSIGNED_CHAR
Performing Test HAVE_CXX_FSIGNED_CHAR - Failed
Performing Test HAVE_C_FSIGNED_CHAR
Performing Test HAVE_C_FSIGNED_CHAR - Failed
Check if the system is big endian
Searching 16 bit integer
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of unsigned short
Check size of unsigned short - done
Using unsigned short
Check if the system is big endian - little endian
Looking for fseeko
Looking for fseeko - not found
Looking for unistd.h
Looking for unistd.h - not found
Check size of off64_t
Check size of off64_t - failed
Looking for assert.h
Looking for assert.h - found
Looking for fcntl.h
Looking for fcntl.h - found
Looking for io.h
Looking for io.h - found
Looking for jbg_newlen
Looking for jbg_newlen - not found
Looking for mmap
Looking for mmap - not found
Looking for search.h
Looking for search.h - found
Looking for string.h
Looking for string.h - found
Looking for unistd.h
Looking for unistd.h - not found
CMake Warning at 3rdparty/ippicv/downloader.cmake:54 (message):
  ICV: Local copy of ICV package has invalid MD5 hash:
  d41d8cd98f00b204e9800998ecf8427e (expected:
  b59f865d1ba16e8c84124e19d78eec57)
Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


ICV: Downloading ippicv_windows_20141027.zip...
CMake Error at 3rdparty/ippicv/downloader.cmake:71 (file):
  file DOWNLOAD HASH mismatch

    for file: [D:/opencv-3.0/opencv/sources/3rdparty/ippicv/downloads/windows-b59f865d1ba16e8c84124e19d78eec57/ippicv_windows_20141027.zip]
      expected hash: [b59f865d1ba16e8c84124e19d78eec57]
        actual hash: [d41d8cd98f00b204e9800998ecf8427e]
             status: [6;"Couldn't resolve host name"]

Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


CMake Error at 3rdparty/ippicv/downloader.cmake:75 (message):
  ICV: Failed to download ICV package: ippicv_windows_20141027.zip.
  Status=6;"Couldn't resolve host name"
Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


Configuring incomplete, errors occurred!
See also "D:/opencv-build/CMakeFiles/CMakeOutput.log".
See also "D:/opencv-build/CMakeFiles/CMakeError.log".

此日志是在生成之后的:

And this log is after generating:

CMake Deprecation Warning at CMakeLists.txt:69 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:74 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Warning at 3rdparty/ippicv/downloader.cmake:54 (message):
  ICV: Local copy of ICV package has invalid MD5 hash:
  d41d8cd98f00b204e9800998ecf8427e (expected:
  b59f865d1ba16e8c84124e19d78eec57)
Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


ICV: Downloading ippicv_windows_20141027.zip...
CMake Error at 3rdparty/ippicv/downloader.cmake:71 (file):
  file DOWNLOAD HASH mismatch

    for file: [D:/opencv-3.0/opencv/sources/3rdparty/ippicv/downloads/windows-b59f865d1ba16e8c84124e19d78eec57/ippicv_windows_20141027.zip]
      expected hash: [b59f865d1ba16e8c84124e19d78eec57]
        actual hash: [d41d8cd98f00b204e9800998ecf8427e]
             status: [6;"Couldn't resolve host name"]

Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


CMake Error at 3rdparty/ippicv/downloader.cmake:75 (message):
  ICV: Failed to download ICV package: ippicv_windows_20141027.zip.
  Status=6;"Couldn't resolve host name"
Call Stack (most recent call first):
  3rdparty/ippicv/downloader.cmake:108 (_icv_downloader)
  cmake/OpenCVFindIPP.cmake:235 (include)
  cmake/OpenCVFindLibsPerf.cmake:12 (include)
  CMakeLists.txt:526 (include)


Configuring incomplete, errors occurred!
See also "D:/opencv-build/CMakeFiles/CMakeOutput.log".
See also "D:/opencv-build/CMakeFiles/CMakeError.log".

CMakeOutput.log和CMakeError.log都不可读.它们充满了无法读取的字符.

Both CMakeOutput.log and CMakeError.log are not readable. They are full of unreadable characters.

如何获得OpenCV的vc14 x86版本!?我被卡住了.

How can I get this vc14 x86 version of opencv!? I'm stuck.

推荐答案

在OpenCVConfig.cmake中,

In OpenCVConfig.cmake,

if(MSVC)
  message("CMAKE_CL_64 is ${CMAKE_CL_64}")
  if(CMAKE_CL_64)
    set(OpenCV_ARCH x64)
  elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
    # see Modules/CmakeGenericSystem.cmake
    set(OpenCV_ARCH ARM)
  else()
    set(OpenCV_ARCH x86)
  endif()

这篇关于C ++如何为vs 2015 x86构建opencv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆