Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED]QtSerialPort installation - details would be welcome

[SOLVED]QtSerialPort installation - details would be welcome

Scheduled Pinned Locked Moved Installation and Deployment
15 Posts 2 Posters 13.4k Views 1 Watching
  • 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 Offline
    J Offline
    JustGreg
    wrote on last edited by
    #1

    Hi to everyone,

    and greetings to all forum members. After several years of programming Windows and embedded devices I've decided to try myself in the Linux domain. I'm coming from C# .NET so it is needless to say that I'm new to Linux and to Qt as well and I'm very well aware that it's going to be a steep learning curve.

    Anyway, I'd like to create a small Qt5 application which can communicate with one of my devices via a CP210x based USB-UART converter. I've already checked with dmesg | grep tty that my converter chip is recognised and connected as ttyUSB0.

    I installed Qt5 and went to QtSerialPort wiki "here":http://qt-project.org/wiki/QtSerialPort. I've downloaded the serialport package as a tarball and extracted it to a folder.

    At the 'Building and Install' section of the wiki, I don't understand the steps. I'm supposed to create a 'serialport-build' folder near a 'serialport-src' but there is no such directory in the extracted folder. It is also not clear how to use the build in my projects. It would be greatly appreciated if someone would explain me the necessary steps to get me started. Thank you.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The "serialport-src" means "name_of_the_folder_where_you_have_qtserialport_sources". In your case, the folder resulting from the extraction of the tarball.

      By the way, depending on how you have gotten Qt5 you might already have QtSerialPort, worth to check.

      Hope it helps

      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
      0
      • J Offline
        J Offline
        JustGreg
        wrote on last edited by
        #3

        Hi SGaist,

        thanks for the reply. How can I check if my Qt5 installation has already have the QtSerialPort? Sorry for being dumb but I'm like stuck in a jungle.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          There are several possibilities, i think the fastest right now is from the command line:

          @find qt_source_folder -iname "qtserialport*"@

          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
          0
          • J Offline
            J Offline
            JustGreg
            wrote on last edited by
            #5

            Thanks. Unfortunately it found nothing.

            However, in the meantime I managed to execute the following (after I've created a serialport-build folder):

            @
            cd /home/notebook/WORK/Qt/qt-qtserialport/serialport-build
            qmake ../serialport-src/qtserialport.pro
            sudo make install
            @

            Now I've got a directory with example, include and src folders, containing .h, .so, .prl, .o, .cpp files. How can I use them? The wiki says that I should add Qt +=serialport to my projects .pro file but it won't compile...probably I need to set the dependencies?

            There is another thing in the wiki:

            @
            #include <QtAddOnSerialPort/serialport.h>
            #include <QtAddOnSerialPort/serialportinfo.h>
            @

            I can't find such directory like 'QtAddOnSerialPort'.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Are you sure you are using Qt 5 qmake ? If you also have Qt 4 dev-tools installed you might be using the wrong one

              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
              0
              • J Offline
                J Offline
                JustGreg
                wrote on last edited by
                #7

                bq. Are you sure you are using Qt 5 qmake ? If you also have Qt 4 dev-tools installed you might be using the wrong one

                How can I check that?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Either:

                  @which qmake@ will give you the complete path to qmake

                  or

                  @qmake --version@ will give you the information about qmake/Qt

                  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
                  0
                  • J Offline
                    J Offline
                    JustGreg
                    wrote on last edited by
                    #9

                    Thanks SGaist, I really appreciate your patience. I've received the following:

                    @
                    notebook@notebook-K50IJ:~$ which qmake
                    /usr/bin/qmake
                    notebook@notebook-K50IJ:~$ qmake --version
                    QMake version 2.01a
                    Using Qt version 4.8.3 in /usr/lib/i386-linux-gnu
                    notebook@notebook-K50IJ:~$
                    @

                    However, in Qt Creator, I'm using Qt5.0.1 and Qt Creator 2.6.2.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      So it means that you compile QtSerialPort for Qt 4.8.3 (not a bad thing)

                      You have to go back to your build directory, remove everything from it, and then run the same command as before but giving the full path to Qt 5 qmake i.e

                      @/usr/local/PATH_TO_QT5_QMAKE/qmake ../qtserialport-src
                      make
                      sudo make install
                      @
                      Don't forget to make first and then make install, otherwise you will build as root

                      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
                      0
                      • J Offline
                        J Offline
                        JustGreg
                        wrote on last edited by
                        #11

                        @Don’t forget to make first and then make install, otherwise you will build as root@

                        Yes, I did it that way before and had to google how to delete all those locked folders. Before I try your suggestion I've got a question: I checked into usr/include folder and found a QtSerialPort directory with the header files serialport.h and serialportinfo.h (probably these are those header files which are mentioned in the wiki, but under 'QtSerialPort' directory instead of 'QtAddOnSerialPort'). Do I need to delete this usr/include/QtSerialPort directory (or uninstall it etc.) before I try your suggestion?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          If you got no use of QtSerialPort for Qt 4 you can do a @sudo make uninstall@ before removing the folder content.

                          Otherwise, I'm pretty sure the include folder will be the same for Qt 5. The include files don't change but the libraries will.

                          You'll have to change your code accordingly using QtSerialPort rather than QtAddOnSerialPort

                          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
                          0
                          • J Offline
                            J Offline
                            JustGreg
                            wrote on last edited by
                            #13

                            Success! At least so far.

                            In my custom project I placed the necessary includes:

                            @
                            #include <QtSerialPort/qserialport.h>
                            #include <QtSerialPort/qserialportinfo.h>
                            @

                            and added

                            @
                            QT += widgets serialport
                            @

                            It compiles.

                            Thank you for yor help!

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              You're welcome !

                              Don't forget to change the thread subject to solved

                              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
                              0
                              • J Offline
                                J Offline
                                JustGreg
                                wrote on last edited by
                                #15

                                Done and thanks a million!

                                1 Reply Last reply
                                0

                                • Login

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