Qt5.7 & Raspberry Pi 3 mkspecs equal signs

  • I have cross-compiled Qt5.7 for RPi 3/EGLFS using the Linaro toolchain (without gnu gold linker). It seems that there are some challenges with the mkspec file (linux-rpi3-g++/qmake.conf).

    To reiterate what has been discussed before: In order to be able to compile Qt itself, the following additions are required:

    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

    This is already a bit dubious, as these (or at least the first one) should be covered by:

    VC_INCLUDE_PATH         = =/opt/vc/include

    However, the extra equal sign results in a strange include path. On the other hand, if the equal sign is removed, ./configure does not recognize EGL.

    When compiling QtWebEngine, there is another similar problem with the VC library paths. The library path is specified without the equal sign:

    VC_LIBRARY_PATH         = /opt/vc/lib

    But it does not help, because the link command is specified as (note the equal sign):

    VC_LINK_LINE            = -L=$${VC_LIBRARY_PATH} -Wl,-rpath-link,$$[QT_SYSROOT]$${VC_LIBRARY_PATH}

    So, the linker command line switch emitted by this is:


    Which leaves the linker looking for libraries in /=/home/user/sysroot/opt/vc/lib.

    This can be partially patched by adding the following line to the mkspec file:

    LIBS += -L$$[QT_SYSROOT]/opt/vc/lib

    With this addition QtWebEngine is successfully built (and works).

    However, this does not happen without side effects. When the library is loaded, there is a run time error:

    [0803/051830:ERROR:surface_factory_qt.cpp(68)] Failed to load /=/opt/vc/lib/libEGL.so.1: /=/opt/vc/lib/libEGL.so.1: cannot open shared object file: No such file or directory

    I guess this could be fixed by removing the VC_LINK_LINE specification altogether, but I have the feeling the specification is there for a reason.

    So how is it supposed to work? What should be done to clear this equal sign mess? Has this got something to do with the differences between toolchains?

  • Just a side note: Instead of patching the mkspec you can fix the header/library mixup using some symlinks as it is done in many tutorials for building Qt ON the Raspi (not cross-compiling).
    For example, see here: https://wiki.qt.io/Native_Build_of_Qt_5.4.1_on_a_Raspberry_Pi#Full_native_build_of_Qt_5.5.1_.28.2Bdocs.29_and_Qt-creator_3.6.0_on_a_Raspberry_Pi_2

  • @micland I thought of that but discarded the idea because Raspbian seems to be the de facto standard distribution for RPi, and IMHO the mkspec should work out-of-the-box with the Rasbian library paths. Or at least there should be a mkspec for Raspbian.

    Also, if I understand it right, the symlinks won't fix the run time error. (But I have to admit I am not at all sure I understand it right.)

    One thing that puzzles me is the big difference between RPi3 and RPi2 mkspecs. Wouldn't it be enough to change the processor optimization flags?

Log in to reply

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