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. How to compile Qt5Websockets and install it on my Qt folder installation?
QtWS25 Last Chance

How to compile Qt5Websockets and install it on my Qt folder installation?

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 7.7k 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.
  • L Offline
    L Offline
    lucaszanella
    wrote on 21 Feb 2019, 04:49 last edited by
    #1

    It appears that libwebsocket is the only library that does not come with Qt (WHY????), so I think I need to compile it and install it in my QT folder so I can use with other things.

    I tried to compile libwebsocket and I got this error:

    qwebsocket_p.h:65:10: fatal error: private/qobject_p.h: No such file or directory
     #include <private/qobject_p.h>
    

    I believe this is because the QT in my system is old. I have a QT installation in my home folder. How should I pass it to websocket?

    If it were with cmake I'd have an idea, but I've heard here https://stackoverflow.com/a/49108604/10116440 that you cannot pass qt folder to qmake. Is there a way to pass to make?

    I also tried doing this in cmake:

    find_package(Qt5WebSockets REQUIRED)
    find_package(Qt5 COMPONENTS Core Qml Quick Svg)
    

    this way I can do cmake -DQt5_DIR=/home/lz/Qt5.11.2 . to set the Qt5 variable for everything except Qt5WebSockets, but the project fails to include <QWebSocket> anyway. If someone knows how to solve this, it'd also be good

    R 1 Reply Last reply 21 Feb 2019, 05:14
    0
    • L lucaszanella
      21 Feb 2019, 04:49

      It appears that libwebsocket is the only library that does not come with Qt (WHY????), so I think I need to compile it and install it in my QT folder so I can use with other things.

      I tried to compile libwebsocket and I got this error:

      qwebsocket_p.h:65:10: fatal error: private/qobject_p.h: No such file or directory
       #include <private/qobject_p.h>
      

      I believe this is because the QT in my system is old. I have a QT installation in my home folder. How should I pass it to websocket?

      If it were with cmake I'd have an idea, but I've heard here https://stackoverflow.com/a/49108604/10116440 that you cannot pass qt folder to qmake. Is there a way to pass to make?

      I also tried doing this in cmake:

      find_package(Qt5WebSockets REQUIRED)
      find_package(Qt5 COMPONENTS Core Qml Quick Svg)
      

      this way I can do cmake -DQt5_DIR=/home/lz/Qt5.11.2 . to set the Qt5 variable for everything except Qt5WebSockets, but the project fails to include <QWebSocket> anyway. If someone knows how to solve this, it'd also be good

      R Offline
      R Offline
      Ratzz
      wrote on 21 Feb 2019, 05:14 last edited by
      #2

      @lucaszanella

      Did you add QT += core websockets to your pro file?

      --Alles ist gut.

      1 Reply Last reply
      1
      • L Offline
        L Offline
        lucaszanella
        wrote on 21 Feb 2019, 05:15 last edited by
        #3

        I forgot to mention that my project is strictly cmake, there are no pro files

        R 1 Reply Last reply 21 Feb 2019, 05:16
        0
        • L lucaszanella
          21 Feb 2019, 05:15

          I forgot to mention that my project is strictly cmake, there are no pro files

          R Offline
          R Offline
          Ratzz
          wrote on 21 Feb 2019, 05:16 last edited by
          #4

          @lucaszanella
          What version of Qt? and on what platform?

          --Alles ist gut.

          L 1 Reply Last reply 21 Feb 2019, 05:31
          0
          • R Ratzz
            21 Feb 2019, 05:16

            @lucaszanella
            What version of Qt? and on what platform?

            L Offline
            L Offline
            lucaszanella
            wrote on 21 Feb 2019, 05:31 last edited by
            #5

            @Ratzz I just installed Qt5.11.2 on my home folder on Ubuntu and I'm doing

            cmake -DQt5_DIR=/home/lz/Qt5.11.2 .

            to force cmake to use it. But since it doesn't come with websockets I'm having problems

            R 1 Reply Last reply 21 Feb 2019, 05:41
            0
            • L lucaszanella
              21 Feb 2019, 05:31

              @Ratzz I just installed Qt5.11.2 on my home folder on Ubuntu and I'm doing

              cmake -DQt5_DIR=/home/lz/Qt5.11.2 .

              to force cmake to use it. But since it doesn't come with websockets I'm having problems

              R Offline
              R Offline
              Ratzz
              wrote on 21 Feb 2019, 05:41 last edited by Ratzz
              #6

              @lucaszanella
              Can you try sudo apt-get install libqt5websockets5-dev
              or try to build it https://github.com/qt/qtwebsockets

              --Alles ist gut.

              J R 2 Replies Last reply 21 Feb 2019, 08:02
              0
              • R Ratzz
                21 Feb 2019, 05:41

                @lucaszanella
                Can you try sudo apt-get install libqt5websockets5-dev
                or try to build it https://github.com/qt/qtwebsockets

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 21 Feb 2019, 08:02 last edited by
                #7

                @Ratzz said in How to compile Qt5Websockets and install it on my Qt folder installation?:

                Can you try sudo apt-get install libqt5websockets5-dev

                He uses custom Qt installation, installing Qt packages from Ubuntu will not help

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

                1 Reply Last reply
                1
                • R Ratzz
                  21 Feb 2019, 05:41

                  @lucaszanella
                  Can you try sudo apt-get install libqt5websockets5-dev
                  or try to build it https://github.com/qt/qtwebsockets

                  R Offline
                  R Offline
                  Ratzz
                  wrote on 21 Feb 2019, 08:14 last edited by
                  #8

                  @Ratzz said in How to compile Qt5Websockets and install it on my Qt folder installation?:

                  or try to build it https://github.com/qt/qtwebsockets

                  @jsulm may be he should use this?

                  --Alles ist gut.

                  L 1 Reply Last reply 21 Feb 2019, 14:09
                  0
                  • R Ratzz
                    21 Feb 2019, 08:14

                    @Ratzz said in How to compile Qt5Websockets and install it on my Qt folder installation?:

                    or try to build it https://github.com/qt/qtwebsockets

                    @jsulm may be he should use this?

                    L Offline
                    L Offline
                    lucaszanella
                    wrote on 21 Feb 2019, 14:09 last edited by
                    #9

                    @Ratzz I tried to build from source, but I think since my QT on computer (not the on on the home folder) is old, I have the error I mentioned in my first post. So I think I have to find a way to compile the websockets library using the QT on the home folder

                    R 1 Reply Last reply 21 Feb 2019, 16:17
                    0
                    • L lucaszanella
                      21 Feb 2019, 14:09

                      @Ratzz I tried to build from source, but I think since my QT on computer (not the on on the home folder) is old, I have the error I mentioned in my first post. So I think I have to find a way to compile the websockets library using the QT on the home folder

                      R Offline
                      R Offline
                      Ratzz
                      wrote on 21 Feb 2019, 16:17 last edited by Ratzz
                      #10

                      @lucaszanella
                      How many versions of Qt is installed in system?
                      What is that old Qt mean?

                      --Alles ist gut.

                      L 1 Reply Last reply 21 Feb 2019, 16:42
                      1
                      • R Ratzz
                        21 Feb 2019, 16:17

                        @lucaszanella
                        How many versions of Qt is installed in system?
                        What is that old Qt mean?

                        L Offline
                        L Offline
                        lucaszanella
                        wrote on 21 Feb 2019, 16:42 last edited by
                        #11

                        @Ratzz I have Qt 5.12.1 installed on my home folder, and the Qt from Ubuntu instaled on the system, which is 5.3. I want to compile libwebsockets using the Qt 5.12.1

                        aha_1980A 2 Replies Last reply 21 Feb 2019, 18:07
                        0
                        • L lucaszanella
                          21 Feb 2019, 16:42

                          @Ratzz I have Qt 5.12.1 installed on my home folder, and the Qt from Ubuntu instaled on the system, which is 5.3. I want to compile libwebsockets using the Qt 5.12.1

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on 21 Feb 2019, 18:07 last edited by
                          #12

                          @lucaszanella so how did you install Qt 5.12.1?

                          And how did you check that you don't have websockets?

                          I really doubt that websockets are missing, since they will be installed by only and offline installer always.

                          The only exception is the distributions package manager, where you may be able to install them separate.

                          Regards

                          Qt has to stay free or it will die.

                          L 1 Reply Last reply 21 Feb 2019, 18:39
                          1
                          • L lucaszanella
                            21 Feb 2019, 16:42

                            @Ratzz I have Qt 5.12.1 installed on my home folder, and the Qt from Ubuntu instaled on the system, which is 5.3. I want to compile libwebsockets using the Qt 5.12.1

                            aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on 21 Feb 2019, 18:12 last edited by
                            #13

                            @lucaszanella,

                            regarding the question:

                            Is there a way to pass to make?

                            Each Qt version has it's own qmake, so by choosing qmake (with full path) you choose the Qt version you wanne use.

                            Regards

                            Qt has to stay free or it will die.

                            1 Reply Last reply
                            1
                            • aha_1980A aha_1980
                              21 Feb 2019, 18:07

                              @lucaszanella so how did you install Qt 5.12.1?

                              And how did you check that you don't have websockets?

                              I really doubt that websockets are missing, since they will be installed by only and offline installer always.

                              The only exception is the distributions package manager, where you may be able to install them separate.

                              Regards

                              L Offline
                              L Offline
                              lucaszanella
                              wrote on 21 Feb 2019, 18:39 last edited by
                              #14

                              @aha_1980 because the project im compiling compiles lots of files that use Qt, but the only problem happens on QtWebsocket. Strangely enough, /home/lz/Qt5.11.2/5.11.2/gcc_64/lib do indeed contain libwebsockets.

                              Does that output mean anything to you?

                              [ 30%] Building CXX object react-native-desktop-orwell/ReactQt/runtime/src/CMakeFiles/react-native.dir/websocketmodule.cpp.o
                              cd /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src && /usr/bin/c++  -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QML_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -Dreact_native_EXPORTS -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/react-native_autogen/include -I/home/lz/orwell/react-native-desktop-orwell/./React/Layout -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/Base64_live555/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/md5/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/JRTPLIB/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/myRtspClient/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/JTHREAD/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../.. -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/jrtplib/src -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtWidgets -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtGui -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtCore -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/./mkspecs/linux-g++ -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtMultimedia -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtNetwork -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtMultimediaWidgets -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtQml -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtQuick  -std=c++11 -fPIC   -fPIC -std=gnu++11 -o CMakeFiles/react-native.dir/websocketmodule.cpp.o -c /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/websocketmodule.cpp
                              /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/websocketmodule.cpp:12:10: fatal error: QWebSocket: No such file or directory
                               #include <QWebSocket>
                              
                              aha_1980A 1 Reply Last reply 21 Feb 2019, 18:44
                              0
                              • L lucaszanella
                                21 Feb 2019, 18:39

                                @aha_1980 because the project im compiling compiles lots of files that use Qt, but the only problem happens on QtWebsocket. Strangely enough, /home/lz/Qt5.11.2/5.11.2/gcc_64/lib do indeed contain libwebsockets.

                                Does that output mean anything to you?

                                [ 30%] Building CXX object react-native-desktop-orwell/ReactQt/runtime/src/CMakeFiles/react-native.dir/websocketmodule.cpp.o
                                cd /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src && /usr/bin/c++  -DQT_CORE_LIB -DQT_GUI_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QML_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -Dreact_native_EXPORTS -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/react-native_autogen/include -I/home/lz/orwell/react-native-desktop-orwell/./React/Layout -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/Base64_live555/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/md5/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/JRTPLIB/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/myRtspClient/include -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../../myRtspClient/third_party/JTHREAD/src -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/../../../.. -I/home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/jrtplib/src -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtWidgets -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtGui -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtCore -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/./mkspecs/linux-g++ -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtMultimedia -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtNetwork -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtMultimediaWidgets -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtQml -isystem /home/lz/Qt5.11.2/5.11.2/gcc_64/include/QtQuick  -std=c++11 -fPIC   -fPIC -std=gnu++11 -o CMakeFiles/react-native.dir/websocketmodule.cpp.o -c /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/websocketmodule.cpp
                                /home/lz/orwell/react-native-desktop-orwell/ReactQt/runtime/src/websocketmodule.cpp:12:10: fatal error: QWebSocket: No such file or directory
                                 #include <QWebSocket>
                                
                                aha_1980A Offline
                                aha_1980A Offline
                                aha_1980
                                Lifetime Qt Champion
                                wrote on 21 Feb 2019, 18:44 last edited by
                                #15

                                @lucaszanella

                                In qmake, you would have to add QT += websockets to your .pro file. I really don't know how the CMake equivalent is.

                                https://forum.qt.io/topic/60975/what-do-i-have-to-add-for-the-qt-websockets-module-in-cmake already discusses this topic, but has not been marked as SOLVED. Therefore I don't know if the solution has been found.

                                Qt has to stay free or it will die.

                                1 Reply Last reply
                                1

                                2/15

                                21 Feb 2019, 05:14

                                topic:navigator.unread, 13
                                • Login

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