Important: Please read the Qt Code of Conduct -

failed to Cross compile Qt 5.6 on RPi 2 (fatal error: bcm_host.h: No such file or directory)

  • Hi I try to cross compile Qt 5.6 for RPi 2 by following this tutorial but I got this error

    qeglfsbrcmintegration.cpp:35:22: fatal error: bcm_host.h: No such file or directory
     #include <bcm_host.h>
    compilation terminated.
    make[6]: *** [.obj/qeglfsbrcmintegration.o] Error 1
    make[6]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm'
    make[5]: *** [sub-eglfs_brcm-make_first] Error 2
    make[5]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs/deviceintegration'
    make[4]: *** [sub-deviceintegration-make_first-ordered] Error 2
    make[4]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms/eglfs'
    make[3]: *** [sub-eglfs-make_first] Error 2
    make[3]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins/platforms'
    make[2]: *** [sub-platforms-make_first] Error 2
    make[2]: Leaving directory `/home/hamed/raspi/qtbase/src/plugins'
    make[1]: *** [sub-plugins-make_first] Error 2
    make[1]: Leaving directory `/home/hamed/raspi/qtbase/src'
    make: *** [sub-src-make_first] Error 2

    what's wrong ?

  • I ran into the same problem following the same tutorial. I got it to compile by adding the following include paths in qtbase/mkspecs/devices/linux-rasp-pi-g++/qmake.conf

    INCLUDEPATH  += $$[QT_SYSROOT]/opt/vc/include
    INCLUDEPATH  += $$[QT_SYSROOT]/opt/vc/include/interface/vcos
    INCLUDEPATH  += $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads
    INCLUDEPATH  += $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux

    Hope that helps!

  • @djunjunjun Thank you , solved.

  • @djunjunjun said:

    INCLUDEPATH += $[QT_SYSROOT]/opt/vc/include
    INCLUDEPATH += $[QT_SYSROOT]/opt/vc/include/interface/vcos
    INCLUDEPATH += $[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads
    INCLUDEPATH += $[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux

    I tried this but found 2 issues with that:

    1. If your are using a Raspberry Pi 2 it needs to go into qtbase/mkspecs/devices/linux-rasp-pi2-g++/qmake.conf
    2. Instead of $[QT_SYSROOT] it should be $ $[QT_SYSROOT] - at least otherwise it did not resolve for me.

    That's at least what I needed to get it to compile.

    [edit: Added space between doubled $ signs to show the difference, space must be removed in .pro file SGaist]

  • Hey,

    I now have the exact same problem that I can't compile Qt because bcm_host.h is missing. I also added the lines to my qmake.conf for rp2.
    The file acutally looks like this:

    # qmake configuration for the Raspberry Pi 2
    QMAKE_LFLAGS           += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
    QMAKE_INCDIR_EGL        = $$[QT_SYSROOT]/opt/vc/include
    QMAKE_LIBS_EGL          = -lEGL -lGLESv2
    QMAKE_LIBS_OPENVG       = -lEGL -lOpenVG -lGLESv2
    QMAKE_CFLAGS            += -march=armv7-a -marm -mthumb-interwork -mfpu=neon-vfpv4 -mtune=cortex-a7 -mabi=aapcs-linux
    DISTRO_OPTS += hard-float
    DISTRO_OPTS += deb-multi-arch
    # Preferred eglfs backend

    The missing file, bcm_host.h, is located at sysroot/opt/vc/include/bcm_host.h
    So, what is wrong here?

    The next thing I don't understand: I have a clean install of Jessie and I have a clean install of Ubuntu 14, running in my virtualbox. Although both systems are new installed, the compilation doesn't work. But I have seen a lot of guys who were able to make a clean installation of Qt on the Pi. How can that be? How is it possible that the installation is working in some cases and in other cases it's not?
    It is very annoying since I already spend several days trying to install Qt on the Pi. I hope anybody can give me the hint I am looking for.

  • Just include the following lines like it was said in the previous threads. This worked for me. I know that this path is also included under QMAKE_INCDIR_EGL, however the below method worked for me. May be you can try this.

    INCLUDEPATH += $$[QT_SYSROOT]/opt/vc/include
    INCLUDEPATH += $$[QT_SYSROOT]/opt/vc/include/interface/vcos
    INCLUDEPATH += $$[QT_SYSROOT]/opt/vc/include/interface/vcos/pthreads
    INCLUDEPATH += $$[QT_SYSROOT]/opt/vc/include/interface/vmcs_host/linux

    and you need to include a $$ before [QT_SYSROOT] in all the links listed above.

  • sorry for my late response, but obviously it was the right thing to do some other stuff in the meantime, because it is working now. Or, at least, the make step was successfull.
    Thanks for that! :)

    When I was looking into my qmake.conf I could see that all the links provided by you are already there, but somehow, I never realized that they have different variable names.
    By default, the links are written in the file with a preceded variable name of "QMAKE_INCDIR_EGL", which is, of course, not the same as "INCLUDEPATH". I don't know why I didn't realized that... anyway, now it's fine.

Log in to reply