I am trying to build Qt5 for the RPi board. The compilation worked fine, but I seem to be having problem with the install step. I get the following error:

fatal error: bcm_host.h: No such file or directory
compilation terminated.

I don't see the bcm_host.h in the /opt/vc/include folder of the RPi file system. Do I need to install a package?

I ran rpi-update. But I'm not sure how to include the directory path for make. So make keeps failing:

../../../../mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp:50:22: fatal error: bcm_host.h: No such file or directory
compilation terminated.
make[5]: *** [.obj/release-shared/qeglfshooks_pi.o] Error 1
make[5]: Leaving directory `/home/gagan/src/rpi/qt-everywhere-opensource-src-5.2.0-beta1/qtbase/src/plugins/platforms/eglfs'
make[4]: *** [sub-eglfs-make_first] Error 2
make[4]: Leaving directory `/home/gagan/src/rpi/qt-everywhere-opensource-src-5.2.0-beta1/qtbase/src/plugins/platforms'
make[3]: *** [sub-platforms-make_first] Error 2
make[3]: Leaving directory `/home/gagan/src/rpi/qt-everywhere-opensource-src-5.2.0-beta1/qtbase/src/plugins'
make[2]: *** [sub-plugins-make_first] Error 2
make[2]: Leaving directory `/home/gagan/src/rpi/qt-everywhere-opensource-src-5.2.0-beta1/qtbase/src'
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory `/home/gagan/src/rpi/qt-everywhere-opensource-src-5.2.0-beta1/qtbase'
make: *** [module-qtbase-make_first] Error 2
  • I thought those files were included with the standard Raspbian install and/or via rpi-update. What system are you using? – joan Sep 7 '15 at 8:24
  • Thanks for the hint. I don't think I ever ran rpi-update. I see the header file generated now. – GMahan Sep 7 '15 at 12:31
  • Generally you shouldn't need to run rpi-update. I use it to check to see if the latest kernel has broken any software. – joan Sep 7 '15 at 12:37
  • Solved it by editing the make file of eglfs library to include the missing directories. – GMahan Sep 7 '15 at 23:12

As mentioned elsewhere on Stack Overflow here: Failed to cross compile Qt 5.6 on RPi 2 (fatal error: bcm_host.h: No such file or directory) and here: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=154749

You are missing the libraspberrypi-dev and kernel header apt packages, which you can install by running:

    sudo apt-get install libraspberrypi-dev raspberrypi-kernel-headers

These packages are NOT included by default with a Raspbian lite distro.

Update: There are some references at https://forum.qt.io/topic/62264/failed-to-cross-compile-qt-5-6-on-rpi-2-fatal-error-bcm_host-h-no-such-file-or-directory/6 which indicate that updating your qmake.conf for the mkspec device will fix this error. I haven't tested that, but it seems reasonable to assume this will bypass whatever is causing the header to not be found if you've followed that other steps above.

| improve this answer | |
  • Just for the people not to well-known with apt-get, the command above is not complete. It should be : sudo apt-get install libraspberrypi-dev raspberrypi-kernel-headers – Wim Haanstra Jul 29 '19 at 17:44
  • I'm running Buster Lite with latest updates and upgrades, and did apt-get install as described above. The first library was present but the second was not, so the latter was installed. However, I still get bcm_host.h not found when I do a make. I see that file in /opt/vc/include/ but it's the only file there, everything else is a folder. Is that file not being placed in the right place by apt-get ? If so, where should I put it ? – NewtownGuy Oct 28 at 15:39

Assuming you pulled your source code from Raspberry Pi's kernel repository on GitHub, you'll want to copy the vc folder inside firmware/hardfp/opt/ into your system's /opt directory. Replace files if cp or mv starts to moan.

Source: Experience

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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