Please nominate your Qt Champions for 2021!

How to add new module ?

  • Dear Sirs,

    I follow this guide to create cross-compiler successfully:
    In this guide, there is a configuration as below:

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi make -j 4 

    I can create and run a simple application successfully. However if my project use more modules, the compiler will fail.
    For example:

    QT += core gui            //This is OK
    QT +=core gui serialport  // Fail

    qml and multimedia also not working on my project.

    Should I add modules on "./configure " ? I check "./configure -help" but there is no "-serialport" or "-qml".
    I have no idea how to proceed.

    Is there anyone know to to add more modules ?


  • Dear All,

    I found this page :
    it says:

    $ cd qt-everywhere-opensource-src-5.0.2/<module>
    $ /usr/local/Qt-5.0.2-raspberry/bin/qmake
    $ make
    $ sudo make install

    so I run above command accordingly, the log in below link :

    I see no error, but when I go back to run QT creater, QT still report :

    error: Unknown module(s) in QT: serialport

    Any suggestions ?

  • Lifetime Qt Champion


    Did you re-run qmake after installing the module ?

  • Dear @SGaist ,

    Yes, after make install (in module folder), I open QT Creater then run clean and build.
    But QT Creator still cannot recognize serialport module.

    PS. I also tried to run "run qmake" from right click menu before build, the result is the same.

  • Lifetime Qt Champion

    Did you check the content of your cross-compiled Qt installation ?

  • Dear @SGaist ,

    Do you mean the content of "qt5/qtbase/include" ?
    In this folder, I don't see "QTSerialPort" or anything related to serialport folder.

    Is there anything wrong ?

  • Lifetime Qt Champion

    @Hiloshi According to the log you posted it should be in /home/hiloshi/rpi/rasp-pi-rootfs/usr/local/qt5pi/include/QtSerialPort

  • Dear @jsulm , @SGaist ,

    Inside the folder, there are:

    hiloshi@ubuntu64:~/rpi/rasp-pi-rootfs/usr/local/qt5pi/include/QtSerialPort$ ls
    5.8.0                QSerialPortInfo      QtSerialPortVersion
    QSerialPort          qserialportinfo.h    qtserialportversion.h
    qserialportglobal.h  QtSerialPort
    qserialport.h        QtSerialPortDepends

    Inside the 5.8.0, there are:

    hiloshi@ubuntu64:~/rpi/rasp-pi-rootfs/usr/local/qt5pi/include/QtSerialPort/5.8.0/QtSerialPort/private$ ls
    qserialportinfo_p.h  qserialport_p.h  qtudev_p.h

    The above data are in the host side raspbian-jessie.img(mount as rasp-pi-rootfs folder).

    Does it mean install successful ?

  • Lifetime Qt Champion

    Looks like it yes.

    Just to be sure, you are are sure you are using the correct qmake for your project ?

  • Dear @SGaist ,

    I think there are something wrong on the way I create project.

    I import example project from:


    and try build and run --> It is working ~~~

    But then I try to create project again, it still show:

    Project ERROR: Unknown module(s) in QT: serialport

    The way I create project is:

    1. select Qt Widgets Application
    2. input project name
    3. Select Kit (Raspberry Pi)
    4. Choose base class "QMainWindow"
    5. Add serialport to the end of "QT += core gui " on pro file
    6. Build

    I compare the pro file of two project, I cannot see the mistake.

    I upload the project:
    Inside the rar, "terminal3" is working project, "terminal" is not working.

    Any suggestion is appreciate.


  • Lifetime Qt Champion

    What do you mean by importing ?

    Take a look at header of the Makefile of the two projects, the qmake line used for each is pretty different.

  • Dear @SGaist ,

    Sorry, it should be "Open Project" not import.

    I may find the reason that cause this issue:

    If I put my project into below folder, then build is OK:


    If I put project on my original workspace, compiler will fail:


    So I feel I may not include correct path into project.
    I go through the options on qt creator, unfortunately I didn't find the place to add path.

    How should I do to fix it ?

  • Lifetime Qt Champion

    Can you try from the command line directly ?

  • Dear @SGaist ,

    I don't familiar with command line operation, but I will check some document and try.

    Do you suspect something wrong with QT Creator ?


  • @SGaist said in How to add new module ?:

    Just to be sure, you are are sure you are using the correct qmake for your project ?

    I think you are correct, I use the wrong qmake.

    My original setting about "qmake location"(in Options->Build&Run->QtVersion) is


    but when I build qbase, I use:

    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=$(which arm-linux-gnueabihf-gcc | sed 's/.\{3\}$//') -sysroot $RPIIMG -opensource -confirm-license -optimized-qmake -reduce-exports -release -no-qml-debug -make libs -make examples -prefix /usr/local/qt5pi -hostprefix $RPIQT

    the -hotprefix is $RPIQT, this location is:


    So I should use ~/rpi/qt5pi/bin/ .

    Can you try from the command line directly ?

    I found this by using command line:

    1. $RPIQT/bin/qmake .
    2. make

    I see no error message so I goback to check qmake location and find this error.

    Thank you very much.

  • Lifetime Qt Champion

    So you have it working now ?

  • Dear @SGaist ,

    Yes, It works fine.

Log in to reply