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. Building Static Qt
Forum Updated to NodeBB v4.3 + New Features

Building Static Qt

Scheduled Pinned Locked Moved Solved General and Desktop
static build
10 Posts 3 Posters 4.3k Views 4 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.
  • S Offline
    S Offline
    shahriar25
    wrote on last edited by
    #1

    Hi, I wanted to build static qt instead of shared mod on linux so I downloaded qt 5.5.1 everywhere (source code) and I installed the stuff on this page on both ubuntu and fedora:

    https://wiki.qt.io/Building_Qt_5_from_Git

    I extracted the zip file and opened terminal in the folder and ran this:
    ./configure -platform linux-g++ -static -release

    the configuration was successful and It told me to run make so I ran make and these errors happened (this is on ubuntu but it was similar to this o fedora):

    g++ -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -o chatserver .obj/main.o .obj/chatserver.o .obj/websocketclientwrapper.o .obj/websockettransport.o .obj/chatserver_plugin_import.o .obj/moc_chatserver.o .obj/moc_websocketclientwrapper.o .obj/moc_websockettransport.o -L/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebsockets/lib -lQt5WebSockets -L/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtbase/lib -L/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebchannel/lib -lQt5WebChannel -L/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtdeclarative/lib -lQt5Qml -L/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtbase/plugins/bearer -lqconnmanbearer -lqgenericbearer -lqnmbearer -lQt5Network -lQt5DBus -lQt5Core -lz -licui18n -licuuc -licudata -lpcre16 -lm -ldl -lgthread-2.0 -pthread -lglib-2.0 -lrt -lpthread
    /home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtdeclarative/lib/libQt5Qml.a(qqmldebugserver.o):qqmldebugserver.cpp:function QQmlDebugServerThread::run(): error: undefined reference to 'QTcpServerConnection::QTcpServerConnection()'
    /home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtdeclarative/lib/libQt5Qml.a(qqmldebugserver.o):qqmldebugserver.cpp:function QQmlDebugServerThread::run(): error: undefined reference to 'non-virtual thunk to QTcpServerConnection::setServer(QQmlDebugServer*)'
    collect2: error: ld returned 1 exit status
    Makefile:105: recipe for target 'chatserver' failed
    make[4]: *** [chatserver] Error 1
    make[4]: Leaving directory '/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebchannel/examples/webchannel/chatserver-cpp'
    Makefile:47: recipe for target 'sub-chatserver-cpp-make_first' failed
    make[3]: *** [sub-chatserver-cpp-make_first] Error 2
    make[3]: Leaving directory '/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebchannel/examples/webchannel'
    Makefile:42: recipe for target 'sub-webchannel-make_first' failed
    make[2]: *** [sub-webchannel-make_first] Error 2
    make[2]: Leaving directory '/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebchannel/examples'
    Makefile:69: recipe for target 'sub-examples-make_first' failed
    make[1]: *** [sub-examples-make_first] Error 2
    make[1]: Leaving directory '/home/shahriar/Desktop/qt-everywhere-opensource-src-5.5.1/qtwebchannel'
    Makefile:459: recipe for target 'module-qtwebchannel-make_first' failed
    make: *** [module-qtwebchannel-make_first] Error 2

    these are the last lines of make after waiting an hour. what sould I do to fix this problem?

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

      hi
      you can try with
      -nomake demos -nomake examples
      with ./configure (add to what u used)
      to skip the samples as it seems error in there.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        shahriar25
        wrote on last edited by
        #3

        Hi, you were right @mrjj
        I used this configuration and then used make:

        ./configure -static -developer-build -opensource -platform linux-g++ -opengl desktop -nomake examples -nomake tests

        and it didn't seem to have any errors.
        Now how do I use this to build my projects staticly?
        I know that there are two ways to do this. the first one is useing qmake from terminal and the second one is from qt IDE itself. the second way is easier so if anyone knows how to do this please tell me
        thanks in advance and thank you @mrjj

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

          Hi,

          Add that version of Qt to Qt Creator in the Build and Run panel and make a kit using it.

          On a side note, unless you plan to fix things / add features to Qt, you should drop the -developer-build option.

          Also, don't forget the licensing implication coming with a static build.

          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
          1
          • S Offline
            S Offline
            shahriar25
            wrote on last edited by
            #5

            Hi, @SGaist thank you for helping
            alright so I did what you said and added the kit and built a very sipmple project in release mode but the size of the executable was 218 mb!!!

            so I built qt in static and release mode to see if the problem is because of the developer build. this is the config:

            ./configure -static -release -prefix /run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1 -opensource -platform linux-g++ -opengl desktop -nomake examples -nomake tests

            the perfix path is the same as the source path

            these are the last lines of building in release with gmake:

            /run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtimageformats/plugins/imageformats/libqjp2.a(jas_stream.o):jas_stream.c:function jas_stream_tmpfile: warning: the use of tmpnam' is dangerous, better use mkstemp'
            gmake[3]: Leaving directory '/run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtquick1/tools/qmlplugindump'
            /run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtimageformats/plugins/imageformats/libqjp2.a(jas_stream.o):jas_stream.c:function jas_stream_tmpfile: warning: the use of tmpnam' is dangerous, better use mkstemp'
            gmake[3]: Leaving directory '/run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtquick1/tools/qml'
            gmake[2]: Leaving directory '/run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtquick1/tools'
            gmake[1]: Leaving directory '/run/media/shahriar/Mine/Qt-release/qt-everywhere-opensource-src-5.5.1/qtquick1'

            and I added the kit like you said and qt IDE gave me this warning:

            Non-installed -prefix build - for internal developement only

            what is this? is this OK?

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

              You have to call make install.

              And you shouldn't put the prefix in the sources, there's nothing to gain from that.

              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
              1
              • S Offline
                S Offline
                shahriar25
                wrote on last edited by
                #7

                Hi @SGaist
                thank you it worked fine. on last thing:

                there is a warning under the kit in qt that says no qmlscene installed. will I have problem deploying quick applications?

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

                  No, this is a helper tool that you can use to prototype QML application. You have more information about it here. You won't need it for deployment.

                  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
                  • S Offline
                    S Offline
                    shahriar25
                    wrote on last edited by
                    #9

                    Hi and thank you all for helping. there only remains the licence issue. I think as long as I keep my apps open source there is no problem with releasing static apps

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

                      As long as you abide by the GPL, you're good.

                      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

                      • Login

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