centos7上的opencv-3.0.0安装错误

时间:2017-05-18 03:40:29

标签: opencv install centos7

我下载opencv-3.0.0.zip并解压缩,然后执行:

 #cd opencv-3.0.0/
 #mkdir build
 #cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=./build -D  WITH_IPP=OFF ../opencv-3.0.0
 #make -j8

并且出现了一些错误:

 ……

[ 49%] Building CXX object 
modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000.cpp.o
In file included from /usr/include/jasper/jasper.h:77:0,
                 from /home/apps/zhimin.feng/software/opencv-3.0.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp:59:
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_mul(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:143:15: error: ‘SIZE_MAX’ was not declared in this scope
if (x && y > SIZE_MAX / x) {
           ^
/usr/include/jasper/jas_math.h: In function ‘bool jas_safe_size_add(size_t, size_t, size_t*)’:
/usr/include/jasper/jas_math.h:170:10: error: ‘SIZE_MAX’ was not declared in this scope
 if (y > SIZE_MAX - x) {
      ^
make[2]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/grfmt_jpeg2000.cpp.o] Error 1
make[1]: *** [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

我可能已安装所有依赖项,但仍会出现错误。

2 个答案:

答案 0 :(得分:6)

我终于找到了答案

SIZE_MAX not declared when trying to build opencv-2.4.10 on raspbian wheezy

编辑/usr/include/jasper/jas_math.h,add

#if ! defined SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif

#include <stdint.h>

答案 1 :(得分:2)

这是yum安装的jasper版本中的失败。目前最好的办法是从15/5/2017发布的更新版本(版本30.el7)降级回基本软件包版本(版本29.el7)

我创建了一张机票here。在此期间运行

sudo yum install jasper-devel-1.900.1-29.el7代替sudo yum install jasper-devel应该做的伎俩