Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problems when adding serialport module in Qt project
Forum Update on Monday, May 27th 2025

Problems when adding serialport module in Qt project

Scheduled Pinned Locked Moved Solved General and Desktop
serialportqserialport
58 Posts 7 Posters 31.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J J.Hilk
    13 Jun 2018, 09:38

    @douglas
    well, there we have your problem

    0_1528882573156_25bb3434-9c9d-43e1-91e3-d1d195bd5377-image.png

    you have no QtLibary selected to your kit. Se if you can actually select a QtVersion from that dropdown menu. If you can't than you need to install an actual qt version.

    I would recommend the online installer from the Webside.

    D Offline
    D Offline
    douglas
    wrote on 13 Jun 2018, 10:07 last edited by
    #20

    @J.Hilk Thanks, I added the version as shown below:
    0_1528884090398_f92cd759-ed4c-403b-9ff6-6b0378c19b45-immagine.png
    Now, since I should have Qt5, I added the serialport support in my .pro file, but the "unknow module" error still remains. I saw another thing that seems not so clear to me: I run Qt Creator from linux terminal, and when I open my project the terminal shows the following lines, marked in red, in which appears Qt4. Can this be related to the serialport module error?
    0_1528884382827_59039698-8cd0-49c5-8a93-a8c89abf87c9-immagine.png
    thank you again.

    J 1 Reply Last reply 13 Jun 2018, 11:47
    0
    • D douglas
      13 Jun 2018, 10:07

      @J.Hilk Thanks, I added the version as shown below:
      0_1528884090398_f92cd759-ed4c-403b-9ff6-6b0378c19b45-immagine.png
      Now, since I should have Qt5, I added the serialport support in my .pro file, but the "unknow module" error still remains. I saw another thing that seems not so clear to me: I run Qt Creator from linux terminal, and when I open my project the terminal shows the following lines, marked in red, in which appears Qt4. Can this be related to the serialport module error?
      0_1528884382827_59039698-8cd0-49c5-8a93-a8c89abf87c9-immagine.png
      thank you again.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 13 Jun 2018, 11:47 last edited by
      #21

      @douglas Above you said you installed Qt 5.6, now you selected Qt 5.7.1
      Which Qt version do you really want to use and did you install QtSearialPort for Qt 5.7.1?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 1 Reply Last reply 13 Jun 2018, 11:54
      0
      • J jsulm
        13 Jun 2018, 11:47

        @douglas Above you said you installed Qt 5.6, now you selected Qt 5.7.1
        Which Qt version do you really want to use and did you install QtSearialPort for Qt 5.7.1?

        D Offline
        D Offline
        douglas
        wrote on 13 Jun 2018, 11:54 last edited by
        #22

        @jsulm when I spoke about Qt 5.6 I was referring to the "About Qt Creator" window shown above. Now I selected Qt 5.7.1 as the version for my kit. But the serialport module isn't recognized yet. What I should do to correctly install QtSerialPort for my actual version?

        P 1 Reply Last reply 13 Jun 2018, 12:25
        0
        • D douglas
          13 Jun 2018, 11:54

          @jsulm when I spoke about Qt 5.6 I was referring to the "About Qt Creator" window shown above. Now I selected Qt 5.7.1 as the version for my kit. But the serialport module isn't recognized yet. What I should do to correctly install QtSerialPort for my actual version?

          P Offline
          P Offline
          Pablo J. Rogina
          wrote on 13 Jun 2018, 12:25 last edited by
          #23

          @douglas could it be possible that you start from scratch with a clean installation of Qt, ideally latest version 5.11? you may try in a virtual machine just in case.

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 13 Jun 2018, 13:36 last edited by
            #24

            Is it me or are you trying to build your project for an embedded system ?
            I see that you are trying to use an arm compiler, did you cross-compile Qt for your device ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            4
            • D Offline
              D Offline
              douglas
              wrote on 13 Jun 2018, 14:46 last edited by
              #25

              @SGaist Yes, my target device runs Linux Yocto. Can this affect the serialport module I am trying to install?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 13 Jun 2018, 21:07 last edited by
                #26

                Sur it does, you are trying to install the desktop version of the driver and then, use it to do cross-compilation.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                D 1 Reply Last reply 14 Jun 2018, 06:28
                2
                • S SGaist
                  13 Jun 2018, 21:07

                  Sur it does, you are trying to install the desktop version of the driver and then, use it to do cross-compilation.

                  D Offline
                  D Offline
                  douglas
                  wrote on 14 Jun 2018, 06:28 last edited by
                  #27

                  @SGaist I see. So, if I need to cross-compile, which steps should I follow in order to use the serialport in my project?
                  Are there different libraries or drivers I need to install on my host PC?
                  The target linux embedded device runs Linux Yocto.

                  J 1 Reply Last reply 14 Jun 2018, 06:33
                  0
                  • D douglas
                    14 Jun 2018, 06:28

                    @SGaist I see. So, if I need to cross-compile, which steps should I follow in order to use the serialport in my project?
                    Are there different libraries or drivers I need to install on my host PC?
                    The target linux embedded device runs Linux Yocto.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 14 Jun 2018, 06:33 last edited by
                    #28

                    @douglas You need Qt (together with Qt Searial Port) cross compiled for your device

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    D 1 Reply Last reply 14 Jun 2018, 07:49
                    2
                    • J jsulm
                      14 Jun 2018, 06:33

                      @douglas You need Qt (together with Qt Searial Port) cross compiled for your device

                      D Offline
                      D Offline
                      douglas
                      wrote on 14 Jun 2018, 07:49 last edited by
                      #29

                      @jsulm I already set up the project in order to cross-compile for my target: in fact, I have already managed to run my application on the target device. The problem is the serial port module: I did not succeeded in including it into my project. Are there any particular hints to follow in the case of cross-compilation?
                      Thank you!

                      J J 2 Replies Last reply 14 Jun 2018, 07:55
                      0
                      • D douglas
                        14 Jun 2018, 07:49

                        @jsulm I already set up the project in order to cross-compile for my target: in fact, I have already managed to run my application on the target device. The problem is the serial port module: I did not succeeded in including it into my project. Are there any particular hints to follow in the case of cross-compilation?
                        Thank you!

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 14 Jun 2018, 07:55 last edited by
                        #30

                        @douglas Did you cross compile Qt serial port module?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1
                        • D douglas
                          14 Jun 2018, 07:49

                          @jsulm I already set up the project in order to cross-compile for my target: in fact, I have already managed to run my application on the target device. The problem is the serial port module: I did not succeeded in including it into my project. Are there any particular hints to follow in the case of cross-compilation?
                          Thank you!

                          J Offline
                          J Offline
                          J.Hilk
                          Moderators
                          wrote on 14 Jun 2018, 07:55 last edited by
                          #31

                          @douglas
                          How did you cross-compile for your target device?

                          I would asume you cloned the qt-sources from git or something similar. However did you crosscompile the whole Framework or only part of it? For any Qt-Program to run you'll need only QtBase, however serialport is a plugin and needs to be compiled seperately.


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          D 1 Reply Last reply 14 Jun 2018, 08:51
                          0
                          • J J.Hilk
                            14 Jun 2018, 07:55

                            @douglas
                            How did you cross-compile for your target device?

                            I would asume you cloned the qt-sources from git or something similar. However did you crosscompile the whole Framework or only part of it? For any Qt-Program to run you'll need only QtBase, however serialport is a plugin and needs to be compiled seperately.

                            D Offline
                            D Offline
                            douglas
                            wrote on 14 Jun 2018, 08:51 last edited by
                            #32

                            @J.Hilk Where can I found the procedure to cross-compile the serial port module?
                            Thank you.

                            J 1 Reply Last reply 14 Jun 2018, 08:53
                            0
                            • D douglas
                              14 Jun 2018, 08:51

                              @J.Hilk Where can I found the procedure to cross-compile the serial port module?
                              Thank you.

                              J Offline
                              J Offline
                              J.Hilk
                              Moderators
                              wrote on 14 Jun 2018, 08:53 last edited by
                              #33

                              @douglas like you did the other modules

                              git clone git://code.qt.io/qt/<qt-module>.git -b <qt-version>
                              cd <qt-module>
                              
                              qmake
                              make
                              make install
                              

                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              P 1 Reply Last reply 14 Jun 2018, 13:07
                              1
                              • J J.Hilk
                                14 Jun 2018, 08:53

                                @douglas like you did the other modules

                                git clone git://code.qt.io/qt/<qt-module>.git -b <qt-version>
                                cd <qt-module>
                                
                                qmake
                                make
                                make install
                                
                                P Offline
                                P Offline
                                Pablo J. Rogina
                                wrote on 14 Jun 2018, 13:07 last edited by
                                #34

                                @douglas if you could please show us

                                How did you cross-compile for your target device?

                                It may help understanding your issue

                                Upvote the answer(s) that helped you solve the issue
                                Use "Topic Tools" button to mark your post as Solved
                                Add screenshots via postimage.org
                                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                D 1 Reply Last reply 14 Jun 2018, 14:48
                                1
                                • P Pablo J. Rogina
                                  14 Jun 2018, 13:07

                                  @douglas if you could please show us

                                  How did you cross-compile for your target device?

                                  It may help understanding your issue

                                  D Offline
                                  D Offline
                                  douglas
                                  wrote on 14 Jun 2018, 14:48 last edited by
                                  #35

                                  @Pablo-J.-Rogina , after the Qt Creator installation, I followed the indication from 2.1 to 2.7 chapter here:
                                  http://variwiki.com/index.php?title=Yocto_Qt_Creator&release=RELEASE_MORTY_V1.0_DART-6UL#QtCreator_configuration
                                  in which, as far as I see, the environment is configured to cross-compile for my target device.
                                  Now, I am able to create a simple GUI application and run it on my target device, but I can't add the serialport component (in order to manage a RS485 communication) in my project.
                                  Unfortunatelly, I'm a beginner in this matter!
                                  Thanks a lot!

                                  P 1 Reply Last reply 14 Jun 2018, 18:30
                                  0
                                  • D douglas
                                    14 Jun 2018, 14:48

                                    @Pablo-J.-Rogina , after the Qt Creator installation, I followed the indication from 2.1 to 2.7 chapter here:
                                    http://variwiki.com/index.php?title=Yocto_Qt_Creator&release=RELEASE_MORTY_V1.0_DART-6UL#QtCreator_configuration
                                    in which, as far as I see, the environment is configured to cross-compile for my target device.
                                    Now, I am able to create a simple GUI application and run it on my target device, but I can't add the serialport component (in order to manage a RS485 communication) in my project.
                                    Unfortunatelly, I'm a beginner in this matter!
                                    Thanks a lot!

                                    P Offline
                                    P Offline
                                    Pablo J. Rogina
                                    wrote on 14 Jun 2018, 18:30 last edited by
                                    #36

                                    @douglas said in Problems when adding serialport module in Qt project:

                                    Now, I am able to create a simple GUI application and run it on my target device

                                    Ok, that's a great step. Reading briefly the link you posted to that wiki page, I assume you setup your environment in a Linux PC and using Qt Creator there, you built that simple GUI app that Qt Creator deployed and run in your device.

                                    If that's correct, I'd try the following:

                                    1. from command line in let's say /home/douglas/projects do
                                    cd /home/douglas/projects
                                    git clone git://code.qt.io/qt/qtserialport.git -b 5.9
                                    cd qtserialport
                                    

                                    so you should now have a folder /home/douglas/projects/qtserialport will sources for Qt serial port module release 5.9 (the Qt release should match what you have in your dev environment/device, you didn't stated it so far).
                                    2. run commands:

                                    /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/qt5/qmake
                                    make
                                    make install
                                    

                                    once build and install finishes, you should have the .so shared library and headers into the proper location under your host PC (I couldn't figure out the proper location from the wiki page). But look for something like this (version shuold be the one you cloned...):

                                    ./include/QtSerialPort/qtserialportversion.h
                                    ./include/QtSerialPort/qserialportinfo.h
                                    ./include/QtSerialPort/qserialportglobal.h
                                    ./include/QtSerialPort/5.9.0/QtSerialPort/private/qserialport_p.h
                                    ./include/QtSerialPort/5.9.0/QtSerialPort/private/qserialportinfo_p.h
                                    ./include/QtSerialPort/qserialport.h
                                    

                                    and

                                    ./lib/libQt5SerialPort.so
                                    

                                    if you succeed here, then you should be able to create a project file (.pro) for your application and add the serial port modulie like this:

                                    ...
                                    QT += serialport
                                    ...
                                    

                                    and the magic will flow.

                                    Upvote the answer(s) that helped you solve the issue
                                    Use "Topic Tools" button to mark your post as Solved
                                    Add screenshots via postimage.org
                                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                    D 1 Reply Last reply 18 Jun 2018, 06:47
                                    2
                                    • P Pablo J. Rogina
                                      14 Jun 2018, 18:30

                                      @douglas said in Problems when adding serialport module in Qt project:

                                      Now, I am able to create a simple GUI application and run it on my target device

                                      Ok, that's a great step. Reading briefly the link you posted to that wiki page, I assume you setup your environment in a Linux PC and using Qt Creator there, you built that simple GUI app that Qt Creator deployed and run in your device.

                                      If that's correct, I'd try the following:

                                      1. from command line in let's say /home/douglas/projects do
                                      cd /home/douglas/projects
                                      git clone git://code.qt.io/qt/qtserialport.git -b 5.9
                                      cd qtserialport
                                      

                                      so you should now have a folder /home/douglas/projects/qtserialport will sources for Qt serial port module release 5.9 (the Qt release should match what you have in your dev environment/device, you didn't stated it so far).
                                      2. run commands:

                                      /opt/fslc-x11/2.2.1/sysroot/x86_64-fslcsdk-linux/usr/bin/qt5/qmake
                                      make
                                      make install
                                      

                                      once build and install finishes, you should have the .so shared library and headers into the proper location under your host PC (I couldn't figure out the proper location from the wiki page). But look for something like this (version shuold be the one you cloned...):

                                      ./include/QtSerialPort/qtserialportversion.h
                                      ./include/QtSerialPort/qserialportinfo.h
                                      ./include/QtSerialPort/qserialportglobal.h
                                      ./include/QtSerialPort/5.9.0/QtSerialPort/private/qserialport_p.h
                                      ./include/QtSerialPort/5.9.0/QtSerialPort/private/qserialportinfo_p.h
                                      ./include/QtSerialPort/qserialport.h
                                      

                                      and

                                      ./lib/libQt5SerialPort.so
                                      

                                      if you succeed here, then you should be able to create a project file (.pro) for your application and add the serial port modulie like this:

                                      ...
                                      QT += serialport
                                      ...
                                      

                                      and the magic will flow.

                                      D Offline
                                      D Offline
                                      douglas
                                      wrote on 18 Jun 2018, 06:47 last edited by
                                      #37

                                      @Pablo-J.-Rogina Thanks a lot for your post, I'll now begin to put it into practice. I have just one doubt: if I run:

                                      qmake --version
                                      

                                      I obtain:

                                      QMake version 2.01a
                                      Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu
                                      

                                      So, if I'm not wrong, the installed version of Qt is the 4.8.7 (quite old). When you stated, in your #1 step, "git clone git://code.qt.io/qt/qtserialport.git -b 5.9" were you assuming my Qt version was 5.9? In other words, the serialport version and the installed qt version should be the same?
                                      If so, how can I upgrade from my actual Qt version to the latest one?
                                      Thanks a lot!

                                      aha_1980A 1 Reply Last reply 18 Jun 2018, 06:54
                                      0
                                      • D douglas
                                        18 Jun 2018, 06:47

                                        @Pablo-J.-Rogina Thanks a lot for your post, I'll now begin to put it into practice. I have just one doubt: if I run:

                                        qmake --version
                                        

                                        I obtain:

                                        QMake version 2.01a
                                        Using Qt version 4.8.7 in /usr/lib/x86_64-linux-gnu
                                        

                                        So, if I'm not wrong, the installed version of Qt is the 4.8.7 (quite old). When you stated, in your #1 step, "git clone git://code.qt.io/qt/qtserialport.git -b 5.9" were you assuming my Qt version was 5.9? In other words, the serialport version and the installed qt version should be the same?
                                        If so, how can I upgrade from my actual Qt version to the latest one?
                                        Thanks a lot!

                                        aha_1980A Offline
                                        aha_1980A Offline
                                        aha_1980
                                        Lifetime Qt Champion
                                        wrote on 18 Jun 2018, 06:54 last edited by
                                        #38

                                        @douglas

                                        you can have multiple Qt versions installed, so please check carefully which one you use.

                                        For the qmakes that are not in PATH, you have to specify the full path, e.g. /opt/Qt/5.9.0/bin/qmake

                                        Regards

                                        Qt has to stay free or it will die.

                                        D 1 Reply Last reply 18 Jun 2018, 06:59
                                        1
                                        • aha_1980A aha_1980
                                          18 Jun 2018, 06:54

                                          @douglas

                                          you can have multiple Qt versions installed, so please check carefully which one you use.

                                          For the qmakes that are not in PATH, you have to specify the full path, e.g. /opt/Qt/5.9.0/bin/qmake

                                          Regards

                                          D Offline
                                          D Offline
                                          douglas
                                          wrote on 18 Jun 2018, 06:59 last edited by
                                          #39

                                          @aha_1980 how I can upgrade to the latest Qt version and set it as default in my project? After this I will be sure to use the Qt version 5.9 and I will apply the steps suggested by @Pablo-J-Rogina
                                          Thank you!

                                          aha_1980A 1 Reply Last reply 18 Jun 2018, 08:09
                                          0

                                          29/58

                                          14 Jun 2018, 07:49

                                          • Login

                                          • Login or register to search.
                                          29 out of 58
                                          • First post
                                            29/58
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved