Qt build for Raspberry Pi 3 on Windows 10 using mingw32, gcc and raspberry-gcc6.3.0-r3 fails



  • Hello everyone,

    I am having issues getting a complete qtbase build for my Raspberry Pi 3 running on my Windows 10 machine. I am using MSYS2 / mingw32, windows toolchain for Raspberry/Pi raspberry-gcc6.3.0-r3 and a gcc version 7.3.0 for building moc.

    I used the following command to configure qt:

    ../qt-everywhere-src-5.11.2/configure.bat -platform win32-g++ -device linux-rasp-pi3-g++ -release -sysroot C://SysGCC//raspberry//arm-linux-gnueabihf//sysroot -prefix //usr//local/qt5 -device-option "CROSS_COMPILE=arm-linux-gnueabihf-" -nomake examples -opensource -confirm-license -D __ARM_ARCH_6__
    

    After configuring I ran mingw32-make -j4 in my build dir, which at some point stops with the following error.

    'C:\SysGCC\raspberry\qt-build\qtbase\bin\moc.exe' -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_INTEGER_EVENT_COORDINATES -DQT_NO_FOREACH -DWTF_EXPORT_PRIVATE= -DJS_EXPORT_PRIVATE= -DENABLE_ASSEMBLER_WX_EXCLUSIVE=1 -DWTFReportAssertionFailure=qmlWTFReportAssertionFailure -DWTFReportAssertionFailureWithMessage=qmlWTFReportAssertionFailureWithMessage -DWTFReportBacktrace=qmlWTFReportBacktrace -DWTFInvokeCrashHook=qmlWTFInvokeCrashHook -DENABLE_LLINT=0 -DENABLE_DFG_JIT=0 -DENABLE_DFG_JIT_UTILITY_METHODS=1 -DENABLE_JIT_CONSTANT_BLINDING=0 -DBUILDING_QT__ -DWTF_USE_UDIS86=0 -DNDEBUG -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_QML_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -D__ARM_ARCH_6__ --include C:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml/.moc/moc_predefs.h -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/memory -IC:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/compiler -IC:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/jsruntime -IC:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/jit -IC:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/debugger -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/animations -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/jit -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/assembler -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/runtime -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/wtf -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/stubs -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/stubs/wtf -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/disassembler -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/3rdparty/masm/disassembler/udis86 -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/.generated -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/include -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/include/QtQml -IC:/SysGCC/raspberry/qt-build/qtdeclarative/include -IC:/SysGCC/raspberry/qt-build/qtdeclarative/include/QtQml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/include/QtQml/5.11.2 -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/include/QtQml/5.11.2/QtQml -IC:/SysGCC/raspberry/qt-build/qtdeclarative/include/QtQml/5.11.2 -IC:/SysGCC/raspberry/qt-build/qtdeclarative/include/QtQml/5.11.2/QtQml -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/include/QtCore/5.11.2 -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/include/QtCore/5.11.2/QtCore -IC:/SysGCC/raspberry/qt-build/qtbase/include/QtCore/5.11.2 -IC:/SysGCC/raspberry/qt-build/qtbase/include/QtCore/5.11.2/QtCore -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/include -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/include/QtNetwork -IC:/SysGCC/raspberry/qt-build/qtbase/include -IC:/SysGCC/raspberry/qt-build/qtbase/include/QtNetwork -IC:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtbase/include/QtCore -IC:/SysGCC/raspberry/qt-build/qtbase/include/QtCore -I. -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/include/c++/6 -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/include/c++/6/backward -Ic:/sysgcc/raspberry/lib/gcc/arm-linux-gnueabihf/6/include -Ic:/sysgcc/raspberry/lib/gcc/arm-linux-gnueabihf/6/include-fixed -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/include -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/include/arm-linux-gnueabihf/c++/6 -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/sysroot/usr/include/arm-linux-gnueabihf -Ic:/sysgcc/raspberry/arm-linux-gnueabihf/sysroot/usr/include C:/SysGCC/raspberry/qt-everywhere-src-5.11.2/qtdeclarative/src/qml/util/qqmladaptormodel.cpp -o .moc/qqmladaptormodel.moc
    mingw32-make[2]: *** [Makefile:12064: .moc/qqmladaptormodel.moc] Error -1073741701
    mingw32-make[2]: Leaving directory 'C:/SysGCC/raspberry/qt-build/qtdeclarative/src/qml'
    mingw32-make[1]: *** [Makefile:53: sub-qml-make_first-ordered] Error 2
    mingw32-make[1]: Leaving directory 'C:/SysGCC/raspberry/qt-build/qtdeclarative/src'
    mingw32-make: *** [Makefile:48: sub-src-make_first] Error 2
    


  • @Napi

    HI and welcome to devnet forum

    I am not sure if it makes a difference, but why are you using duplicated forward slashes '/'?
    Possibly the OS or something is getting confused there, but that is a weak argument.

    Out personal experience I recommend to use simply forward slashes '/' especially with everything involving Qt. However, there is no duplication required. Respectively that is exactly the reason I have switched to forward slashes also on Windows.



  • @koahnig

    Thanks for your reply and the warm welcoming :-) !

    I had issues with using forward and backward slashes '/' and '' , I wasn't really sure which ones are the proper one, but double forward slashes seem to work. I will try the single once again.



  • So the good news is that the build is now successful, but the generated binaries don't work on the Raspberry Pi. I get the following output if I try to run qtdiag:

    pi@raspberrypi:/usr/local/qt5/bin $ ./qtdiag
    Illegal instruction
    

    Here are additional informations:

    pi@raspberrypi:/usr/local/qt5/bin $ uname -a
    Linux raspberrypi 4.9.59+ #1 Sun May 27 09:24:00 PDT 2018 armv6l GNU/Linux
    pi@raspberrypi:/usr/local/qt5/bin $ file qtdiag 
    qtdiag: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpr
    eter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=1ba239f99cc632f0bc1acbb4a
    d77b2847be60890, stripped
    

    I guess something went wrong during configuring, but I am not quite sure what.



  • @Napi

    The cross-compile went through with only one forward slash?

    Did you try to cross-compile and run a simple "hello world" console application without Qt first?



  • @koahnig
    Yup, cross-compile worked without an error. I wrote a simple app in order to test if the compiler works before I started building Qt.

    #include <stdio.h>
    
    int main()
    {
      printf("Hello world! \n");
      return 0;
    }
    

    And the make file on my Windows host.

    
    all:
    	arm-linux-gnueabihf-g++.exe -ggdb main.cpp -o main
    clean:
    	rm main
    

    App works fine on the Raspberry Pi.



  • @Napi

    That is good.

    You have copied the required dynamic link libs to RPi?

    I have basically the cross-compiled folder to my embedded board. Eventually you need to set a path for your application to find the dynamic link libs. I have set

    export LD_LIBRARY_PATH=/home/ubuntu/QtForBBB/lib:. 
    

    Not sure if the structure could be the same on your board. I have done on Beagle Bone Black.

    Also I have done the cross-compile on Linux Ubuntu desktop with VirtualBox, because the cross-compiler for windows I did not get to work.



  • @koahnig

    I copied the complete install folder:

    pi@raspberrypi:/usr/local/qt5 $ ls
    bin  doc  include  lib  plugins  qml  translations
    

    I also tried to set the path for my app, as you suggested:

    export LD_LIBRARY_PATH=/usr/local/qt5/lib:.
    

    But I am still getting the same message:

    pi@raspberrypi:/usr/local/qt5/bin $ ./qtdiag
    Illegal instruction
    


  • @koahnig

    It looks like the libs get loaded but there is something wrong with libQt5Core.

    gdb qtdiag
    GNU gdb (Raspbian 7.12-6) 7.12.0.20161007-git
    Copyright (C) 2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "arm-linux-gnueabihf".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from qtdiag...(no debugging symbols found)...done.
    (gdb) r
    Starting program: /usr/local/qt5/bin/qtdiag 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
    
    Program received signal SIGILL, Illegal instruction.
    0xb610cb30 in qRegisterResourceData(int, unsigned char const*, unsigned char const*, unsign
    ed char const*) () from /usr/local/qt5/lib/libQt5Core.so.5
    


  • @Napi

    The only idea Ihave at the time being would be to create a simple console app based on the creator template and do also a simple hello world output. This would be very basic again, but also involve a minimum Qt.

    When it fails too, there is something fundamental with Qt cross-compile.

    As explained before, all this is outside of my experience. I am trying to get someone else interested to have a look here.



  • @koahnig

    Thank you so much for your help so far!
    I think I am going to start by only building qt-base, which I am then going to use as a starting point for a simple app.

    Here is a link with the exact steps I did, just in case Iink.



  • @Napi

    Certainly stepping back in complexity shall help.

    The cross-compile on Windows for linux and/or embedded linux is possible, but requires a bit more steam to get around all the obstacles.



  • @koahnig
    So I managed to compile qtBase, but now it seems that dependencies are missing. I was trying to run
    ./examples/gui/analogclock/analogclock, this is the error message I get:

    qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
    qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in ""
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    

    I tried the following:

    export QT_QPA_PLATFORM=eglfs
    export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/qt5/plugins/platforms
    export LD_LIBRARY_PATH=/usr/local/qt5/lib
    sudo ldconfig
    


  • @Napi

    Try to compile a very basic program using Qt. Use the Qt console template fromQt creator and compile and run on RPi without any modifications. This should work IMHO.

    Are you using Qt creator?

    When the very basic console application does not work, you have fundamental issue there. From having no additions at all, you can implement complexity step-by-step (e.g. qDebug() and so on).

    Afterwards you can worry about the additional modules required. The problem is that this might become quite tedious.



  • @koahnig

    So I did a build using the Qt Creator and the Qt Console Application template and it worked fine.

    I also tried the AnalogClock example afterwards, whit no success. There might be some issue with OpenGl or the renderer in general.

    Update: I got the example running !!!!!! Yeah !!! I did a rebuild off the whole qt base without using the batch file for configuring!

    0_1543789077149_572b9752-2c6f-45de-bfe5-3d4f586c03f4-image.png



  • So one issue that I have now is the fact that some paths on the raspberry qt build are wrong, someting wasn't right during configuring. This is the error I get running the 2dpainting example.

    0_1543807841441_2a7eb842-ab8d-4e51-9dec-961d9a4f1dc0-image.png

    The interesting thing here is, that QFontDatabase url is strange, I ran the following configure command:

    ../qt-everywhere-src-5.11.2/qtbase/configure -platform win32-g++ -device linux-rasp-pi-g++ -release -sysroot C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot -prefix /usr/local/qt5 -device-option "CROSS_COMPILE=arm-linux-gnueabihf-" -opensource -confirm-license -opengl es2 -no-use-gold-linker -make libs
    


  • @Napi

    Congrats for your progress.

    You are right that the URL is strange.
    I have just scanned through the source of Qt5.11.2 as shipped with a MinGW pre-built. The given text is part of c:\Qt\5.11.2\Src\qtbase\src\platformsupport\fontdatabases\freetype\qfreetypefontdatabase.cpp

    However opening the URL brings up a site with that name, but it is not really what I expected. First of all it is in French and it does not hold direct information with respect to fonts.



  • @Napi

    Some information from Qt on fondconfig https://doc.qt.io/qt-5/qt-embedded-fonts.html

    Here is a Qt reference to dejavu fonts http://doc-snapshots.qt.io/qt5-5.12/qtgui-attribution-dejayvu.html
    This points to https://dejavu-fonts.github.io/ which makes sense compared to the strange URL.

    [edit: koahnig form here]
    Digging a bit deeper and checked current Qt5.12.0 source holding this:

        if (!dir.exists()) {
            qWarning("QFontDatabase: Cannot find font directory %s.\n"
                     "Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig.",
                     qPrintable(fontpath));
            return;
    

    In up-coming release the correct link is referenced.



  • Also the source contained in today's release Qt5.11.3 has the github.io reference. Checked with MinGW pre-built.



  • @koahnig

    I am trying version 5.12.0 now. Thank you!



  • @koahnig and @Napi
    I am somewhat of a noob and looking this work. Are there instructions you followed to the get this to work?

    Thank you very much for you help.



  • @FluxDice

    Hi and welcome to devnet forum

    Here is a link to the Qt documentation for cross compiling.
    https://doc.qt.io/qt-5/embedded-linux.html

    For raspberry specifically there is also https://www.raspberrypi.org/forums/viewtopic.php?t=204778


Log in to reply
 

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