Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Installation QT 5.11 on Raspberry Pi 3



  • @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    Start with only qtbase

    sorry, but what this means?


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    Start with only qtbase

    sorry, but what this means?

    Qt is comprised of many repositories, which contain modules inside. qtbase is the most basic repo, and contains QtCore, QtGui, QtNetwork and some other stuff.

    If you want to compile only qtbase, you have 3 options:

    • if you are using git repos, you need to call the init_repository script and specify qtbase only. More info: guide
    • if you are using Qt tarballs (I recommend this solution), you can simply remove all forlders apart from qtbase from the uncompressed tarball
    • you can also pass -skip qtmodulename to configure, but that would require you to pass all the modules apart from those found in qtbase... that's a lot of typing

    Then you just run configure as usual.



  • hi @gogoer
    Just one side note. I periodically cross-compile qt with all working modules for rpi. This is done on a HP Z440 with 8 cores an 16GB RAM. The compilation takes about 2 hours.
    But even if you just compile qtbase, prepare for a long long time to wait, way longer than set up the cross-toolchain on a desktop.



  • what folders i need to leave if i want only use basecal QT, QTQuick and QTQuickControls 2.3 and QML.


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    what folders i need to leave if i want only use basecal QT, QTQuick and QTQuickControls 2.3 and QML.

    • qtbase
    • qtdeclarative
    • qtquickcontrols2

    Optionally:

    • qtsvg
    • qttools
    • qtx11extras
    • qtgraphicaleffects
    • qtmultimedia


  • @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    Use linux-g++ mkspecs instead of the Raspberry Pi one when you compile natively.

    what i need to do?

    i deleted folders, except your list.
    now i use config string:

    ../qt-everywhere-src-5.11.2/configure -v -opengl es2 -eglfs -no-gtk -device linux-rasp-pi-g++ \
    -opensource -confirm-license -reduce-exports \
    -force-pkg-config -nomake examples -no-compile-examples -release \
    -qt-pcre -ssl -evdev -system-freetype -fontconfig -glib -prefix /opt/qt5
    

    but i have error:

    Cannot compile minimal program. The toolchain or QMakeSpec is broken.
    

  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    -device linux-rasp-pi-g++

    Remove that, it should be enough.

    If not, you can specify the mkspecs using this flag:

    configure -platform linux-g++
    


  • Thank you!
    configuration is successfull.
    i start compilation by

    make -j 4
    

    and it compiles about an hour, then gives error:

    make[3]: Leaving directory '/home/pi/otp/qt5/build/qtbase/src/testlib'
    make[2]: Leaving directory '/home/pi/otp/qt5/build/qtbase/src'
    Makefile:48: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/pi/otp/qt5/build/qtbase'
    Makefile:52: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    

    what i can do to solve this?


  • Moderators

    That output does not give details about any errors. Run make (without -j) and / or look for real error in the output (something coming from either linker or the compiler).



  • it gives

    g++: internal compiler error: Segmentation fault (program cc1plus) 
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
    

    and after gives error i write upper.


  • Moderators

    Whoa, that I have not seen before. Perhaps try with some older Qt release, maybe it won't trigger the compiler error. Also, disable tests as it seems to happen in test lib (-nomake tests -nomake examples).


  • Moderators

    Also, as @sneubert suggests, cross compilation will allow you to build much, much faster.



  • @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    g++: internal compiler error: Segmentation fault (program cc1plus)

    That might be an out of memory error. I used to see that when I tried to build Qt in a VM that was not given enough memory.



  • @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    Also, as @sneubert suggests, cross compilation will allow you to build much, much faster.

    maybe you can give link to manual, how crosscompile QT from windows? i have not linux machine now.
    i found only manuals to crosscompile from linux.


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    maybe you can give link to manual, how crosscompile QT from windows?

    You like making things harder for yourself, right? ;-) There is this guide but it's known to work for a very limited range of Qt versions only.

    A much better option is to set up some Linux OS (in a virtual machine or as dual boot on your PC) and cross compile via Linux. It's really much easier to do (which does not mean it is easy...). Installing a Linux distro like Ubuntu takes 20 minutes.



  • @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    A much better option is to set up some Linux OS (in a virtual machine or as dual boot on your PC) and cross compile via Linux. It's really much easier to do (which does not mean it is easy...). Installing a Linux distro like Ubuntu takes 20 minutes.

    ok, i'll make so))) if have problems (99%) i'll ask here or create new topic?


  • Moderators

    As you prefer, I don't mind.



  • I installed Ubuntu 18.04 in VirtualBox and now trying to install QT, following this:
    http://doc.qt.io/QtForDeviceCreation/qtee-preparing-hardware-rasberrypi.html
    I downloaded online installer, but i cant find QT for Device Creation. Only QT 5.11.2 and modules.
    Can I install all i need via online installer?



  • i compile QT in Ubuntu and have error:

    arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/opt/qt5pi/sysroot -Wl,-O1 -Wl,-rpath-link,/opt/qt5pi/sysroot/opt/vc/lib -Wl,-rpath-link,/opt/qt5pi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/opt/qt5pi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
    /opt/qt5pi/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 crt1.o: Нет такого файла или каталога
    /opt/qt5pi/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 crti.o: Нет такого файла или каталога
    /opt/qt5pi/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 -lm

    what can i do?


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    it gives

    g++: internal compiler error: Segmentation fault (program cc1plus) 
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
    

    and after gives error i write upper.

    More than likely you ran out of memory. That's when I see internal compiler errors. You can make g++ use less memory by not using -pipe which will write intermediate stuff to disk rather than piping it to the next process.

    Like others have said you're much better off cross compiling on a good system, but if you want to continue you just need to lower g++'s memory consumption. The easiest way to do that is not allowing piping.

    Edit: I replied before I saw @mranger90's post... he's absolutely right, that's exactly what popped into my head too. ;)


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    @sierdzio said in Installation QT 5.11 on Raspberry Pi 3:

    A much better option is to set up some Linux OS (in a virtual machine or as dual boot on your PC) and cross compile via Linux. It's really much easier to do (which does not mean it is easy...). Installing a Linux distro like Ubuntu takes 20 minutes.

    ok, i'll make so))) if have problems (99%) i'll ask here or create new topic?

    Definitely get at least a linux vm... using windows for anything other than playing video games is so 1990s ;)

    Windows lost the OS wars about a decade ago and is very far behind posix OSes now.


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    i compile QT in Ubuntu and have error:

    arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/opt/qt5pi/sysroot -Wl,-O1 -Wl,-rpath-link,/opt/qt5pi/sysroot/opt/vc/lib -Wl,-rpath-link,/opt/qt5pi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/opt/qt5pi/sysroot/lib/arm-linux-gnueabihf -o verifyspec verifyspec.o
    /opt/qt5pi/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 crt1.o: Нет такого файла или каталога
    /opt/qt5pi/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 crti.o: Нет такого файла или каталога
    /opt/qt5pi/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 -lm

    what can i do?

    These errors are because of your sysroot. They come from not having glibc (or whatever libc you use) in the target architecture. Those should be in your sysroot directory.

    What is in /opt/qt5pi/sysroot? Is that a valid directory? What's the output of find /opt/qt5pi/sysroot ?



  • i correct sysroot problem, thank you.

    i deleted folders except listed upper.

    then i configure with:

    ../qt-everywhere-src-5.11.2/configure -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot /opt/qt5pi/sysroot -prefix /usr/local/qt5pi -opensource -confirm-license -skip qtscript -nomake examples -nomake tests -make libs -pkg-config -no-use-gold-linker -v
    

    and its configured without errors, just some notes.

    during compilation have errors:

    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp: В функции-члене «virtual void QEglFSKmsGbmWindow::resetSurface()»:
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:58:5: ошибка: нет декларации «PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC» в этой области видимости
         PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
         ^
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:58:46: ошибка: expected «;» before «createPlatformWindowSurface»
         PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
                                                  ^
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:61:9: ошибка: нет декларации «createPlatformWindowSurface» в этой области видимости
             createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
             ^
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:61:56: ошибка: expected type-specifier before «PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC»
             createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
                                                            ^
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:61:56: ошибка: expected «>» before «PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC»
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:61:56: ошибка: expected «(» before «PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC»
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:62:68: ошибка: expected «)» before «;» token
                 eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
                                                                        ^
    /opt/qt5pi/qt-everywhere-src-5.11.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp:65:9: ошибка: нет декларации «createPlatformWindowSurface» в этой области видимости
         if (createPlatformWindowSurface) {
             ^
    Makefile:2877: recipe for target '.obj/qeglfskmsgbmwindow.o' failed
    make[7]: *** [.obj/qeglfskmsgbmwindow.o] Error 1
    make[7]: *** Ожидание завершения заданий…
    make[7]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms»
    Makefile:72: recipe for target 'sub-eglfs_kms-make_first' failed
    make[6]: *** [sub-eglfs_kms-make_first] Error 2
    make[6]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src/plugins/platforms/eglfs/deviceintegration»
    Makefile:104: recipe for target 'sub-deviceintegration-make_first-ordered' failed
    make[5]: *** [sub-deviceintegration-make_first-ordered] Error 2
    make[5]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src/plugins/platforms/eglfs»
    Makefile:125: recipe for target 'sub-eglfs-make_first' failed
    make[4]: *** [sub-eglfs-make_first] Error 2
    make[4]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src/plugins/platforms»
    Makefile:102: recipe for target 'sub-platforms-make_first' failed
    make[3]: *** [sub-platforms-make_first] Error 2
    make[3]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src/plugins»
    Makefile:776: recipe for target 'sub-plugins-make_first' failed
    make[2]: *** [sub-plugins-make_first] Error 2
    make[2]: выход из каталога «/opt/qt5pi/qt5build/qtbase/src»
    Makefile:48: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: выход из каталога «/opt/qt5pi/qt5build/qtbase»
    Makefile:52: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    

    what it can be?


  • Moderators

    Oh, I remember stumbling upon that error myself, but I don't remember how I resolved it myself (possibly by switching OpenGL driver in pi-config and updating sysroot).

    These might help:



  • thank your all!!! i compiled and builed qt 5.10.1. I tryed build 5.11.2, but have errors. I think 5.10.1 is enough.
    I installed QTCreator and configured it. But when i compile project, i have error:

    sys/cdefs.h: no such file or directory
    

    file cdefs.h is in /usr/include/sys/cdefs.h, ichecked it.
    i do:

    export Path=$PATH:/usr/include
    

    but i have same error still building project in QTCreator.
    what i need to do to solve this?


  • Moderators

    Have you followed the guide for setting up Qt Creator for use with RPi? https://wiki.qt.io/RaspberryPi2EGLFS#Qt_Creator



  • yes i do.
    but at Kit screen i have error: compiler "RaspGCC" (x86-linux-generic-elf-64bit) cant create code for QT profile "Q5.10.1 (qt5pi)" (arm-linux-generic-elf-32bit).


  • Moderators

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    yes i do.
    but at Kit screen i have error: compiler "RaspGCC" (x86-linux-generic-elf-64bit) cant create code for QT profile "Q5.10.1 (qt5pi)" (arm-linux-generic-elf-32bit).

    Hm, unless you misconfigured the RaspGCC compiler (see in "compilers" tab), it should work. If you're using Qt creator 4.7, try with 4.6. I've seen similar issues on Android with newest QtC, perhaps it's just IDE bug.



  • i configured everythin by manual one more time, now when i create empty qtquick project in qtcreator and try to build it, i have in console output:

    cannot run target compiler 'arm-linux-gnueabihf-g++'
    

  • Qt Champions 2019

    @gogoer Please show you compiler configuration in "Compiler" tab.



  • here it:
    0_1542052879388_Снимок экрана от 2018-11-12 10-27-23.png


  • Qt Champions 2019

    @gogoer If you copy/past the path to compiler into a terminal: does it start/run?



  • yes, in terminal this path works good!



  • maybe i need to use another compiler? why this dont work?



  • here is the output:

    16:24:47: Выполняются этапы для проекта 111...
    16:24:47: Запускается: «/opt/qt5pi/sysroot/usr/local/qt5pi/bin/qmake» /home/pasha/111/111.pro -spec devices/linux-rasp-pi3-g++ CONFIG+=debug CONFIG+=qml_debug
    Project ERROR: Cannot run target compiler 'arm-linux-gnueabihf-g++'. Output:
    ===================
    Using built-in specs.
    COLLECT_GCC=arm-linux-gnueabihf-g++
    Target: arm-linux-gnueabihf
    Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/src/gcc-linaro-4.8-2014.01/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/install --with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch --with-arch=armv6 --with-tune=arm1176jz-s --with-fpu=vfp --with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gold --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-float=hard
    Thread model: posix
    gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) 
    COLLECT_GCC_OPTIONS='-march=armv8-a' '-mtune=cortex-a53' '-mfpu=crypto-neon-fp-armv8' '-mfloat-abi=hard' '-E' '-v' '-shared-libgcc' '-mtls-dialect=gnu'
     /opt/qt5pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus -E -quiet -v -imultilib . -imultiarch arm-linux-gnueabihf -iprefix /opt/qt5pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/ -isysroot /opt/qt5pi/sysroot -D_GNU_SOURCE - -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -mtls-dialect=gnu
    /opt/qt5pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
    ===================
    Maybe you forgot to setup the environment?
    16:24:47: Процесс «/opt/qt5pi/sysroot/usr/local/qt5pi/bin/qmake» завершился с кодом 3.
    Ошибка при сборке/установке проекта 111 (комплект: Raspberry)
    Во время выполнения этапа «qmake»
    16:24:47: Прошло времени: 00:00.
    
    my path to qmake: ```
    /opt/qt5pi/sysroot/usr/local/qt5pi/bin/qmake
    

    is it ok?


  • Qt Champions 2019

    @gogoer said in Installation QT 5.11 on Raspberry Pi 3:

    libz.so.1: cannot open shared object file: No such file or directory

    Where is your sysroot and does it contain libz.so.1?



  • thank you!!!!
    i make:

    sudo apt-get install zlib1g:i386
    

    and it go on!!



  • I compiled my project and copy executable file to RPI.
    But when I execute it, i have error

    *failed to add service - already in use?
    

    it crashes on function

    QGuiApplication app(argc, argv);
    

    and one more question: i create and install qt5.10 on ubuntu, what i need to do to update qt version on RPI? as i understand it still uses old version.


  • Qt Champions 2019

    @gogoer I don't know what "service" is mentioned in the error.
    "install qt5.10 on ubuntu, what i need to do to update qt version on RPI" - do you mean you cross-compiled Qt 5.10 on your Ubuntu machine? If so you can copy the libs to the same location or RPi you defined using -prefix parameter.



  • yes, i cross-compile on ubuntu. what directory i need to copy to RPI? and what is -prefix parameter?


Log in to reply