I've tried following this tutorial: https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/

I installed a fresh copy of Raspbian Buster on the Raspberry Pi 2 before following the tutorial.

It gave me errors after running “make -j$(nproc)”:

[ 34%] Building CXX object samples/opengl/CMakeFiles/example_opengl_opengl.dir/opengl.cpp.o
/home/pi/opencv/samples/opengl/opengl.cpp:14:14: fatal error: GL/glu.h: No such         
file or directory
 #include <GL/glu.h>
 compilation terminated.
 make[2]: *** [samples/opengl/CMakeFiles/example_opengl_opengl.dir/build.make:63: 
 samples/opengl/CMakeFiles/example_opengl_opengl.dir/opengl.cpp.o] Error 1
 make[1]: *** [CMakeFiles/Makefile2:37187: 
 samples/opengl/CMakeFiles/example_opengl_opengl.dir/all] Error 2
 make[1]: *** Waiting for unfinished jobs....

At the very end of “make -j$(nproc)”:

[ 37%] Built target opencv_cvv
make: *** [Makefile:163: all] Error 2

I am very new to raspberry pi's and OpenCV so I do not know if the tutorial is valid or outdated. Thanks for the help.

  • looks like a bunch of header files are missing Commented Dec 22, 2019 at 23:20
  • @JaromandaX Yes I see that, but I don't know why or how to install them
    – Titan
    Commented Dec 22, 2019 at 23:22
  • did you run all the commands in Step 2: Install OS Libraries - were there any errors? in second tutorial it's the apt get after Then you can install all the important tools and libraries needed for OpenCV Commented Dec 22, 2019 at 23:25
  • @JaromandaX As I mentioned before, the first tutorial had a "Timeout" error after executing "sudo apt-get -y install libgtk2.0-dev libtbb-dev qt5-default"
    – Titan
    Commented Dec 22, 2019 at 23:28
  • this timeout occur every time you tried? or did you try once and think it wasn't important to install those libraries? Commented Dec 22, 2019 at 23:29

1 Answer 1


If you do not have special requirements to compile OpenCV from source it is not a good idea to do it, in particular by newbies. You find the OpenCV library in the default Raspbian repository. Just look at it with:

rpi ~$ apt list *opencv*

You will find 75 packages. Just pick that one you need and install it.

rpi ~$ sudo apt install python3-opencv

may be a good choice.

  • Thank you! This is so much easier than what I was doing, happy holidays!
    – Titan
    Commented Dec 25, 2019 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.