2

I'm trying to build opencv-3.4.0 (with opencv_contrib-3.4.0) on Raspberry Pi. I'm getting a cmake build error after a 99 % , what should I change?

After I tried "make -j4" in the opencv-3.4.0/build folder, it successfully completed its process until 99%. Before that, configuration and generation part is done with cmake-gui.

Here is the error I am getting on the terminal

    make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:63: modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:4018: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
    make: *** [Makefile:163: all] Error 2

What could be the problem?

efedoganay
  • 133
  • 2
  • 11
  • A messages like `Error 1` is just a summary about **previous errors**. Run `make` (without `-j` argument, so command's output won't be mixed) and find the **actual error message**. – Tsyvarev Jul 31 '19 at 08:09
  • aha, just hit the same thing, /home/pi/opencv-3.4.0/modules/python/src2/cv2.cpp: In function ‘bool pyopencv_to(PyObject*, T&, const char*) [with T = cv::String; PyObject = _object]’: /home/pi/opencv-3.4.0/modules/python/src2/cv2.cpp:885:34: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char* str = PyString_AsString(obj); – pootle Jul 31 '19 at 17:14

2 Answers2

2

Edit the file /home/pi/opencv-3.4.0/modules/python/src2/cv2.cpp and change

char* str = PyString_AsString(obj);

to const char* str = PyString_AsString(obj);

-1

A slightly sideways answer, but I found that version 4.1 (without contribs - haven't tried it with) builds with no problems

pootle
  • 507
  • 6
  • 15