# Make Error with v4.5.4 under Bullseye/Raspberry Pi Model B

**URL:** <https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173>\
**Category:** Python\
**Tags:** build\
**Created:** [November 12, 2021, 6:13pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173 "2021-11-12T18:13:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![baqwas](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baqwas](https://forum.opencv.org/u/baqwas)\
**Post date:** [November 12, 2021, 6:13pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/1 "2021-11-12T18:13:21Z")

</div>

Hello,

I’ve done **make** many, many times on a Raspberry Pi B over the years with whatever clone was current from GitHub. I recently upgraded to Bullseye (from Buster). Did a refresh using **ccmake …** and **cmake .** and had a minor issue to attend to (_viz._ gcc-10 was installed but there was no link to g++; resolved by re-installing _build-essential_).

In running **make** , right at the end I received the following error message:

```auto
[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
/home/pi/projects/opencv/modules/python/src2/cv2.cpp:17:10: fatal error: Python.h: No such file or directory
   17 | #include <Python.h>
      | ^ ~~~~~~~~~
compilation terminated.
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:82: modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:5101: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make: *** [Makefile:182: all] Error 2

```

I am a total _newbie_ with OpenCV source; I can run the examples modestly (in Python and C/C++). The above error seems to be some issue with references in my configuration. I don’t inspect the _Makefile.txt_ at all but do make some changes through **ccmake** depending on the hardware platform that is under study and personal interest in understanding some OpenCV features. As you can see from the subject field, this hardware platform is rather old but in the long run I’ve always succeeded in getting OpenCV built with plenty of patience.

I need help to fix this issue, please! The message is understandable but, of course, I have zero knowledge on where to start! Appreciate any guidance. Thanks.

Kind regards.

---

<div class="post-metadata">

**Author:** ![mshabunin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mshabunin/32/15_2.png) [@mshabunin](https://forum.opencv.org/u/mshabunin)\
**Post date:** [November 12, 2021, 6:48pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/2 "2021-11-12T18:48:22Z")

</div>

Probably you somehow misconfigured Python bindings. Do you have `python3-dev` (or similar) package installed? Did you set any Python-related variables in cmake, maybe some are wrong or missing? Did you try a clean build?

---

<div class="post-metadata">

**Author:** ![baqwas](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baqwas](https://forum.opencv.org/u/baqwas)\
**Post date:** [November 12, 2021, 7:16pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/3 "2021-11-12T19:16:56Z")

</div>

_Do you have `python3-dev` (or similar) package installed?_  
Yes, Python3 is the workhorse on this platform. I just noticed that Bullseye jumped the version from 3.7 to 3.9! Perhaps, that did unlink something but I have no understanding here of how to recover.

_Did you set any Python-related variables in cmake, maybe some are wrong or missing?_  
Didn’t change anything in **ccmake** that is directly linked to any Python setting. I use **cmake** without further changes from the preceding **ccmake** step. Python2 was disabled in a previous build (the one that was successful prior to the current` git pull origin main`). So perhaps there is some unlinking (unknown to me) going on with the system change from Python 3.7 to Python 3.9.

_Did you try a clean build?_  
I always have to make changes through **ccmake** owing the limitations of the ARM6l hardware platform. So, pardon me, I am not following what would constitute a _clean_ build. I refreshed the local sources in May/June and the same set of commands ( **ccmake** , **cmake** , **make** , **make install** ) worked without breaking issues but I thought that the _Makefile_ in the `./opencv/build` sub-folder is never touched by the refresh. The only new module that I’m trying with this build is Eigen3 that I had omitted previously.

Do let me know if you spot anything in my responses that you feel requires me to take a few steps back. It takes almost 18 hours 😀 to do a build on this old machine (but it is worth it, I must confess). Thanks.

Kind regards.

---

<div class="post-metadata">

**Author:** ![mshabunin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mshabunin/32/15_2.png) [@mshabunin](https://forum.opencv.org/u/mshabunin)\
**Post date:** [November 12, 2021, 7:40pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/4 "2021-11-12T19:40:23Z")

</div>

I’m talking about python3- **dev** package specifically, it should contain Python.h file. `apt list python3-dev` command should hsow it as `[installed]`.

_clean build_ means you remove build directory and create a new one. Changes in the code (`git pull`) or configuration (packages installed/removed, options changed) can result in broken build directory contents and cmake scripts usually do not cover these cases.

For better reproducibility I’d recommend using cmake directly, avoiding ccmake. Once you know which options you need it is easy to use them in cmake command line (in shell script), e.g. `cmake -DBUILD_opencv_python2=OFF .. && cmake --build .`.

And I’d recommend using cross-compilation on regular machine, it can be tricky to setup but the time spent should be less than 18hrs 🙂 . You will need Docker-container based on same Debian version with cross-compilation tools installed (g+±10-arm-linux-gnueabi and some others). Some command-line options can be found in [buildbot logs](https://pullrequest.opencv.org/buildbot/builders/master_ARMv7-lin/builds/11710/steps/cmake/logs/stdio). Major problem of cross-compilation is linking with dependencies matching your target platform, but it should be possible. There are many other guides and methods in the internet, e.g. [Cross-Compiling for Raspberry Pi - Kitware Blog](https://blog.kitware.com/cross-compiling-for-raspberry-pi/)

---

<div class="post-metadata">

**Author:** ![baqwas](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baqwas](https://forum.opencv.org/u/baqwas)\
**Post date:** [November 12, 2021, 10:22pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/5 "2021-11-12T22:22:36Z")

</div>

Hello @mshabunin,

Thanks for the advice. Appreciate ALL of it. I will work in step-wise fashion with your notes. Your first paragraph makes sense because I had to reinstall build-essential. Therefore I shouldn’t take python3-dev for granted. I think this suggestion is the problem solver, IMHO.

Your other suggestions are excellent too. My desktop required only 16 mins to build OpenCV early this year. Bypassing **ccmake** makes a lot sense except that specifically for the RPiB (almost 8 years old and still going strong) but there are some granular selections that are needed for the apps on that board only. OpenCV has done a lot of improvement in this respect (especially with the transition to Python3 by default).

Thanks very much for the links. Now that I know I have access to HELP, I’ll take the plunge with cross-compilation. I had so many problems with it for IoT devices from OnSemi that I had to stop.

Kind regards.

---

<div class="post-metadata">

**Author:** ![baqwas](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baqwas](https://forum.opencv.org/u/baqwas)\
**Post date:** [November 12, 2021, 11:06pm UTC](https://forum.opencv.org/t/make-error-with-v4-5-4-under-bullseye-raspberry-pi-model-b/6173/6 "2021-11-12T23:06:19Z")

</div>

Hello again @mshabunin,

Thanks to you I found the error! The _Makefile_ was still pointing to python **3.7m** folder instead of python **3.9** where the header file was located.

Kind regards.
