1

I'm trying to build opencv-2.4.10 on my Raspberry Pi model B (wheezy) following these instructions but am getting the error below. What's the best way of fixing this?

[ 14%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o In file included from /usr/include/jasper/jasper.h:77:0, from /home/pi/opencv-2.4.10/modules/highgui/src/grfmt_jpeg2000.cpp:58: /usr/include/jasper/jas_math.h: In function ‘int jas_safe_size_mul(size_t, size_t, size_t*)’: /usr/include/jasper/jas_math.h:117:22: error: ‘SIZE_MAX’ was not declared in this scope modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:422: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o' failed make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/grfmt_jpeg2000.cpp.o] Error 1 CMakeFiles/Makefile2:1772: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 Makefile:133: recipe for target 'all' failed make: *** [all] Error 2

Gavin
  • 1,223
  • 15
  • 20

1 Answers1

4

I'm not sure if its best practice but after trying to correct by defining __STDC_LIMIT_MACROS, I gave up and edited /usr/include/jasper/jas_math.h, adding

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

right after

#include <stdint.h>
  • It's certainly not best practice ... that would be to submit a solution back to the (assumed open source) root of the problem. But I recognise it as common practice :-) – Gavin Feb 08 '17 at 16:42
  • it's not a good way. [How to get SIZE_MAX in C89](https://stackoverflow.com/q/44401965/995714) – phuclv Jun 07 '17 at 01:58