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



  • I am trying to compile a Qt project that uses serialport module. I have installed the module using:

    sudo apt-get install libqt5serialport5
    sudo apt-get install libqt5serialport5-dev
    

    The serialport is added in my .pro file:

    QT += core gui network serialport
    

    and the module is included in my header file:

    #include < QtSerialPort/QSerialPort>
    

    But when I compile, it says:

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

    Any idea what's wrong?

    alt text


  • Moderators

    @pbdot You installed libqt5serialport5 from the Linux distribution, but the qt in /usr/local/qt5 is for sure not the one from the distribution. Did you install qt5 by yourself in /usr/local/qt5? If so then you have to make sure libqt5serialport5 is installed there.



  • Thanks @jsulm

    Qt was installed through Raspbian package manager using:

    sudo apt-get install qt5-qmake
    sudo apt-get install libqt5
    

    I can compile other project without issue, for example project using QNetwork which is included by default. Just not this one with QSerialPort.

    How do I make sure libqt5serialport5 is there in /usr/local/qt5?


  • Moderators

    @pbdot I'm not sure Raspbian is installing Qt in /usr/local/qt5, at least I wouldn't expect this. Are you sure /usr/local/qt5 is Qt from Raspbian you installed?
    What does (in a terminal)

    which qmake
    

    say?



  • Running which qmake returns the following:

    pi@raspberrypi:~/SerialSend$ which qmake
    /usr/bin/qmake
    pi@raspberrypi:~/SerialSend$ qmake
    qmake: could not exec '/usr/lib/arm-linux-gnueabihf/qt4/bin/qmake': No such file or directory
    

    Hm. I think I made some mistake but I am a bit hazy now why I ended up with 2 qmake:

    • one in /usr/local/qt5 which is qt version 5
    • and another in /usr/bin/qmake which seems to be qt version 4 but somehow didn't work


  • It seems that there are 2 qmake in the system:

    • /usr/bin/qmake : system seems to recognize this in the path
      if I run it, it will complain "qmake: could not exec '/usr/lib/arm-linux-gnueabihf/qt4/bin/qmake': No such file or directory"
    • /usr/local/qt5/bin/qmake : system doesn't recognize it but it will run just fine if I specify full path like:
      /usr/local/qt5/bin/qmake
      make clean
      make

    I purged the old one by:

    > sudo apt purge qt4*
    

    After this, the system can recognize the qt5 qmake which is located at /usr/local/qt5

    I then reinstalled serialport module:

    > sudo apt-get install libqt5serialport5
    > sudo apt-get install libqt5serialport5-dev
    

    But now if run qmake, it complains:

    qmake: could not find a Qt installation of ''
    

    I checked my .bashrc file and at the end of the file, it has:

    export LD_LIBRARY_PATH=/usr/local/qt5/lib/
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/qt5/bin
    


  • I am able to compile the project with serialport now after reinstalling qt5

    > sudo apt-get install qt5-default
    

    But I've got different error now which I think is a different issue altogether.

    Unable to query physical screen size, defaulting to 100 dpi.

    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
    QOpenGLShaderProgram: could not create shader program
    QOpenGLShader: could not create shader
    Could not link shader program:
     ""
    QOpenGLShaderProgram: could not create shader program
    QOpenGLShader: could not create shader
    QOpenGLShaderProgram::uniformLocation( texture ): shader program is not linked
    


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