Cross Compiling for Raspberry: QtCreator does not find GLES2/gl2.h



  • Hi,

    I cross compiled Qt for Raspberry on my Linux machine. I can perfectly compile my project using cmake on the command line. I tried to set up a kit in QtCreator so that I can debug on the device. However, when compiling through creator I get the error that

    GLES2/gl2.h is not found.

    I wonder what I am doing wrong. Of course I mounted the sysroot and set it in the kit. In the sysroot, I see that the required file is present under /opt/vc/include/GLES2

    Or should he use not the one of the sysroot? How can I make QtCreator look there?

    Thanks!



  • Ok, manually adding a line
    include_directories(/opt/vc/include/GLES2) to my cmake solves the issue (although I do not understand why it works without that line if I use cmake with a toolchain file)

    However, now I get the errors
    :-1: warning: libGLESv2.so, needed by /opt/qt5pi/lib/libQt5Quick.so.5.11.1, not found (try using -rpath or -rpath-link)
    :-1: warning: libz.so.1, needed by /opt/qt5pi/lib/libQt5Network.so.5.11.1, not found (try using -rpath or -rpath-link)
    :-1: warning: libpng16.so.16, needed by /opt/qt5pi/lib/libQt5Gui.so.5.11.1, not found (try using -rpath or -rpath-link)

    I don't really understand, does it want those libraries from the Sysroot? Ok, If I add
    link_directories(/opt/raspberry_sysroot/usr/lib/arm-linux-gnueabihf/)
    link_directories(/opt/raspberry_sysroot/usr/lib/)
    this problem disappears



  • But Now I get a new problem:
    libQt5Network.so.5.11.1 /opt/qt5pi/lib/libQt5Gui.so.5.11.1 common/libcommon.a /opt/qt5pi/lib/libQt5Core.so.5.11.1 && :
    /opt/raspberry_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/libc.so.6
    /opt/raspberry_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /usr/lib/arm-linux-gnueabihf/libc_nonshared.a
    /opt/raspberry_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
    collect2: error: ld returned 1 exit status

    I don't understand why he is using the absolute path here



  • Or alternatively: Can I make QtCreator use my working Toolchain file?



  • @maxwell31 have you checked the Qt Creator section of this cross-compile guide for RPi?



  • Yes, I think I did it more or less according to this section. However, I did not use the rsync method but work with an image file. So the problem seems to be that he does not use the sysroot I specify in qt creator.

    Also, why does the linker look for
    /lib/arm-linux-gnueabihf/libc.so.6
    and not simply for libc.so.6 somewhere in the link path?



  • I managed to get it working via manually setting CMAKE_FIND_ROOT_PATH to sysroot in the build settings of the kit


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.