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, 2015 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, 2015 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, 2015 at 12:37
  • Solved it by editing the make file of eglfs library to include the missing directories.
    – GMahan
    Sep 7, 2015 at 23:12

4 Answers 4


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.

  • 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 Jul 29, 2019 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, 2020 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


The above solutions didn't work for me primarily because I didn't have the expected /firmware/hardfp directory at all. For me, what worked resulted from trial and error but worth noting for someone working with newer RPi4 Model B.

Kernel version:

        Linux raspberrypi 5.10.17-v7l+ #1421 SMP Thu May 27 14:00:13 BST 2021 armv7l GNU/Linux

GPU firmware:

        /opt/vc/bin/vcgencmd version
        May 27 2021 14:02:15 
        Copyright (c) 2012 Broadcom
        version 7d9a298cda813f747b51fe17e1e417e7bf5ca94d (clean) (release) (start)


  1. Copy the bcm_host.h file from /opt/vc/include to /usr/include. This resulted in compilation error for more missing files like so:
        fatal error: interface/vmcs_host/vc_dispmanx.h: No such file or directory
         #include "interface/vmcs_host/vc_dispmanx.h"
       compilation terminated.
  1. I looked in the /opt/vc/include/interface/vmcs_host directory and found the file was present there. So, as suggested in other posts, I copied the entire contents of /opt/vc/include to /usr/include.

As a result, my program has compiled and I see errors that are related to the code itself.

Edit: Later, I found out that -lbcm_host library is not found by the linker as well. This resolved, as suggested on a thread in rpi forums, after I copied the contents of /opt/vc/lib, especially the libbcm_host.so into /usr/lib


apt-get install libraspberrypi-dev is enough to resolve the issue.

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.