2

I try to cross compile Qt 5.6 for RPi 2 by following this tutorial https://wiki.qt.io/RaspberryPi2EGLFS 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?

demonplus
  • 5,613
  • 12
  • 49
  • 68
Hamed
  • 31
  • 2
  • 4
  • Similar question has been asked before here: http://raspberrypi.stackexchange.com/questions/36121/fatal-error-bcm-host-h-no-such-file-or-directory-compilation-terminated (solution inside). – kfunk Jan 03 '16 at 18:58
  • Solution posted here, it works 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/4, you need two $ signs as specified in the last post of this forum link – webaba Mar 31 '16 at 14:27

3 Answers3

1

The error message indicates one of two problems. Either:

  1. The file bcm_host.h does not exist on your system, or:
  2. The file exists, but the compiler can't find it.

To see whether the file exists, you can run:

$ find / -name bcm_host.h 2>/dev/null

If bcm_host.h doesn't exist, you need to fix that situation somehow. This post suggests installing libraspberrypi-dev.

Once bcm_host.h exists on your system, you need to make sure the compiler can find it. This post mentions that it may be necessary to create a symlink to wherever the build system is looking for include files. To see what the default include path is, you can run:

$ echo | cpp -Wp,-v

Then make your symlink accordingly. Or, you can try invoking make this way:

$ CPPFLAGS=-I/path/to/bcm_host.h make
evadeflow
  • 4,704
  • 38
  • 51
  • I have the files in my host Linux at `/home/hamed/raspi/sysroot/opt/vc/include/` but compiler cant find the files I try use CPPFLAGS arg but it dos not works `make CPPFLAGS=I/home/hamed/raspi/sysroot/opt/vc/include/bcm_host.h` `qeglfsbrcmintegration.cpp:35:22: fatal error: bcm_host.h: No such file or directory ` – Hamed Jan 03 '16 at 19:41
  • it dose't work again CPPFLAGS=-I/home/hamed/raspi/sysroot/opt/vc/include/bcm_host.h make – Hamed Jan 03 '16 at 19:56
  • I think I should change eglfs library makefile to include the missing files but I don't know how !? – Hamed Jan 03 '16 at 19:59
  • `CPPFLAGS` should contain _paths_, not files, so try: `CPPFLAGS=-I/home/hamed/raspi/sysroot/opt/vc/include`. Or just run `$ sudo ln -s /usr /opt/vc` in a terminal as suggested in the linked post. – evadeflow Jan 03 '16 at 20:11
1

In your .pro file (project file) add :

INCLUDEPATH += /home/hamed/raspi/sysroot/opt/vc/include

and then recompile.

if it doesn't work, remove the build folder and then recompile.

Ali Diouri
  • 86
  • 1
  • 9
1

add in this file: ~/raspi/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro

INCLUDEPATH += ~/raspi/sysroot/opt/vc/include

after :

$ make

and

make install
medismail
  • 29
  • 4