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?

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 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

    RatzzR 1 Reply Last reply
    0
    • L lucaszanella

      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

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on 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 last edited by
        #3

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

        RatzzR 1 Reply Last reply
        0
        • L lucaszanella

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

          RatzzR Offline
          RatzzR Offline
          Ratzz
          wrote on last edited by
          #4

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

          --Alles ist gut.

          L 1 Reply Last reply
          0
          • RatzzR Ratzz

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

            L Offline
            L Offline
            lucaszanella
            wrote on 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

            RatzzR 1 Reply Last reply
            0
            • L lucaszanella

              @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

              RatzzR Offline
              RatzzR Offline
              Ratzz
              wrote on 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.

              jsulmJ RatzzR 2 Replies Last reply
              0
              • RatzzR Ratzz

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

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on 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
                • RatzzR Ratzz

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

                  RatzzR Offline
                  RatzzR Offline
                  Ratzz
                  wrote on 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
                  0
                  • RatzzR Ratzz

                    @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 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

                    RatzzR 1 Reply Last reply
                    0
                    • L lucaszanella

                      @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

                      RatzzR Offline
                      RatzzR Offline
                      Ratzz
                      wrote on 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
                      1
                      • RatzzR Ratzz

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

                        L Offline
                        L Offline
                        lucaszanella
                        wrote on 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
                        0
                        • L lucaszanella

                          @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 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
                          1
                          • L lucaszanella

                            @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 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

                              @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 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
                              0
                              • L lucaszanella

                                @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 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

                                • Login

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