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. Link to QT statically
Forum Updated to NodeBB v4.3 + New Features

Link to QT statically

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 5 Posters 14.6k Views 3 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.
  • K Offline
    K Offline
    Khalid80
    wrote on 13 Jan 2018, 15:58 last edited by
    #1

    is there how-to build QT binaries statically, I need to static link so i dont need to ship any QT binaries to windows, Mac-OS and linux.

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yuvaram
      wrote on 13 Jan 2018, 16:10 last edited by yuvaram
      #2

      Hi @Khalid80

      Project A should link Project B library statically.

      In Project B
      projectB.pro file add CONFIG += staticlib

      In project A
      projectA.pro file add LIBS += -L$$PWD/-lprojectA

      Yuvaram Aligeti
      Embedded Qt Developer
      : )

      1 Reply Last reply
      1
      • L Offline
        L Offline
        Leonardo
        wrote on 13 Jan 2018, 16:24 last edited by
        #3

        You'll need to compile Qt yourself. Just add the "-static" flag to the "configure" command line.

        1 Reply Last reply
        3
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 13 Jan 2018, 16:31 last edited by
          #4

          Hi
          Please be aware that using Qt as static library requires you to
          1: release the source code as open source
          Or
          own a Qt license.

          Also to use static on all platforms, you will need to build Qt as static lib on all platforms.

          I used this for Qt5.7 and mingw
          https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

          1 Reply Last reply
          3
          • K Offline
            K Offline
            Khalid80
            wrote on 13 Jan 2018, 17:46 last edited by
            #5

            Thanks all, is there any diff between building it on windows using MinGW and linux or Mac?

            Y 1 Reply Last reply 13 Jan 2018, 17:51
            0
            • K Khalid80
              13 Jan 2018, 17:46

              Thanks all, is there any diff between building it on windows using MinGW and linux or Mac?

              Y Offline
              Y Offline
              yuvaram
              wrote on 13 Jan 2018, 17:51 last edited by
              #6

              @Khalid80
              Qt source code can be used in multiple platform to compile but the same binary or library cannot be used in all the OS.
              Qt great advantage is code once, but compile for all the platforms.

              Yuvaram Aligeti
              Embedded Qt Developer
              : )

              1 Reply Last reply
              1
              • K Offline
                K Offline
                Khalid80
                wrote on 16 Jan 2018, 00:00 last edited by
                #7

                yes, but I am talking about how to build QT statically on Linux or mac-os, @mrjj mention he did it for windows using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, is there any tutorial for Linux and macos?

                Y 1 Reply Last reply 16 Jan 2018, 04:21
                0
                • K Khalid80
                  16 Jan 2018, 00:00

                  yes, but I am talking about how to build QT statically on Linux or mac-os, @mrjj mention he did it for windows using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, is there any tutorial for Linux and macos?

                  Y Offline
                  Y Offline
                  yuvaram
                  wrote on 16 Jan 2018, 04:21 last edited by
                  #8

                  @Khalid80
                  all the steps are common for all the platforms.
                  As specified earlier .pro file CONFIG is specified staticlib.

                  Yuvaram Aligeti
                  Embedded Qt Developer
                  : )

                  K 1 Reply Last reply 16 Jan 2018, 14:37
                  4
                  • Y yuvaram
                    16 Jan 2018, 04:21

                    @Khalid80
                    all the steps are common for all the platforms.
                    As specified earlier .pro file CONFIG is specified staticlib.

                    K Offline
                    K Offline
                    Khalid80
                    wrote on 16 Jan 2018, 14:37 last edited by
                    #9

                    @yuvaram I am talking on building the QT binaries as static libs, not linking my project statically. my project will link to QT static libraries, so I have to build all the QT statically

                    K 1 Reply Last reply 17 Jan 2018, 15:11
                    0
                    • K Khalid80
                      16 Jan 2018, 14:37

                      @yuvaram I am talking on building the QT binaries as static libs, not linking my project statically. my project will link to QT static libraries, so I have to build all the QT statically

                      K Offline
                      K Offline
                      Khalid80
                      wrote on 17 Jan 2018, 15:11 last edited by
                      #10

                      @Khalid80 so far I built QT statically using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, and then I created a static lib (Core.a) which is linking statically to QT, after that I created a test app the link to core.a but getting Core.cpp:-1: error: undefined reference to `QArrayData::shared_null'.

                      J 1 Reply Last reply 18 Jan 2018, 05:43
                      0
                      • K Khalid80
                        17 Jan 2018, 15:11

                        @Khalid80 so far I built QT statically using https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW tutorial, and then I created a static lib (Core.a) which is linking statically to QT, after that I created a test app the link to core.a but getting Core.cpp:-1: error: undefined reference to `QArrayData::shared_null'.

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 18 Jan 2018, 05:43 last edited by
                        #11

                        @Khalid80 said in Link to QT statically:

                        linking statically to QT

                        to which parts of Qt?

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

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          Khalid80
                          wrote on 18 Jan 2018, 13:58 last edited by
                          #12

                          I built all QT platform statically and I am linking for now to QT5Core and QT5Network

                          1 Reply Last reply
                          0

                          1/12

                          13 Jan 2018, 15:58

                          • Login

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