centos7上opencv-3.0.0安装报错
opencv-3.0.0 install error on 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....
我可能已经安装了所有的依赖,但仍然出现错误。
我终于从
找到了答案
SIZE_MAX not declared when trying to build opencv-2.4.10 on raspbian wheezy
编辑/usr/include/jasper/jas_math.h,添加
#if ! defined SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif
之后
#include <stdint.h>
这是 jasper 的 yum 安装版本失败。目前最好的办法是从 2017 年 5 月 15 日发布的更新版本(版本 30.el7)降级回基础包版本(版本 29.el7)
我创建了一张工单 here。同时运行
sudo yum install jasper-devel-1.900.1-29.el7
而不是 sudo yum install jasper-devel
应该可以做到这一点
我下载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....
我可能已经安装了所有的依赖,但仍然出现错误。
我终于从
找到了答案SIZE_MAX not declared when trying to build opencv-2.4.10 on raspbian wheezy
编辑/usr/include/jasper/jas_math.h,添加
#if ! defined SIZE_MAX
#define SIZE_MAX (4294967295U)
#endif
之后
#include <stdint.h>
这是 jasper 的 yum 安装版本失败。目前最好的办法是从 2017 年 5 月 15 日发布的更新版本(版本 30.el7)降级回基础包版本(版本 29.el7)
我创建了一张工单 here。同时运行
sudo yum install jasper-devel-1.900.1-29.el7
而不是 sudo yum install jasper-devel
应该可以做到这一点