Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Building Qt as static libraries and linking on RedHat 7.2

Building Qt as static libraries and linking on RedHat 7.2

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
static librarystatic linking
17 Posts 3 Posters 5.8k 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.
  • S Simon Platten
    21 Sept 2016, 12:13

    Thank you, I retraced my steps and this is the link I was originally using and am now using again:

    http://doc.qt.io/qt-5/linux-deployment.html

    The reason for static over dynamic is to simplify the role out, we are using Qt for development and as far as I am aware they're isn't a package and deployment tool that would help greatly and if it existed would mean we could use the shared object libraries.

    [Edit] The build of the static libraries has finished however, I don't see libQt5SerialPort.a which I need...

    K Offline
    K Offline
    kshegunov
    Moderators
    wrote on 21 Sept 2016, 12:40 last edited by
    #4

    @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

    as far as I am aware they're isn't a package and deployment tool that would help greatly and if it existed would mean we could use the shared object libraries.

    It exists - the Qt Maintenance Tool. It allows you to select what binaries to install (compiler compatibility/Qt version) and where. If it's for development only, I usually use my own build from git. Static lib is really, really bad idea for development, the linker step can take forever. Also you can build Qt (or rather the QtBase module) dynamically and build anything that depends on it statically, with the assumption the modules you need are relatively small (as is with QtSerialPort).

    The build of the static libraries has finished however, I don't see libQt5SerialPort.a which I need

    Did you do an install? Usually it'd be in <QT_SOURCE_DIR>/src/qtserialport/lib if you didn't install.

    Kind regards.

    Read and abide by the Qt Code of Conduct

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Simon Platten
      wrote on 21 Sept 2016, 12:55 last edited by Simon Platten
      #5

      Thank you I am rebuilding the library now. The static build is intended purely for deployment and release not development.

      I though the maintenance tool was for system recovery, didn't realise it was for deployment.

      [Edit] I just ran the Maintenance tool and it is as I thought a recovery and removal tool. There is nothing in it to help deployment and packaging.

      Kind Regards,
      Simon Platten

      K 1 Reply Last reply 21 Sept 2016, 12:58
      0
      • S Simon Platten
        21 Sept 2016, 12:55

        Thank you I am rebuilding the library now. The static build is intended purely for deployment and release not development.

        I though the maintenance tool was for system recovery, didn't realise it was for deployment.

        [Edit] I just ran the Maintenance tool and it is as I thought a recovery and removal tool. There is nothing in it to help deployment and packaging.

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 21 Sept 2016, 12:58 last edited by kshegunov
        #6

        @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

        I though the maintenance tool was for system recovery, didn't realise it was for deployment

        It is not. It's for development. For deployment, there's the specific Qt tool for windows and osx, for linux you'd usually not deploy Qt along (at least I don't).
        EDIT: I've misread your post, sorry for the confusion about the Qt Maintenance tool.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Simon Platten
          wrote on 21 Sept 2016, 13:02 last edited by
          #7

          No problem, what I would like is a packager that identifies what libraries are required, grabs them and packages then into an installer that we can use for installations and be assured that nothing is missing.

          Kind Regards,
          Simon Platten

          K 1 Reply Last reply 21 Sept 2016, 13:12
          0
          • S Simon Platten
            21 Sept 2016, 13:02

            No problem, what I would like is a packager that identifies what libraries are required, grabs them and packages then into an installer that we can use for installations and be assured that nothing is missing.

            K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 21 Sept 2016, 13:12 last edited by
            #8

            @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

            No problem, what I would like is a packager that identifies what libraries are required, grabs them and packages then into an installer that we can use for installations and be assured that nothing is missing.

            That's the thing, you shouldn't ... it's sounds counterintuitive I know, but Linux distros have their own repository and in that repository there's Qt, to which you should stick. Qt is binary compatible just for that reason, the API is allowed to (breakingly) change only between major versions, which means that things developed with Qt 5.0 should work out of the box if you just substitute the target of the libQt5Core.so symbolic link from libQt5Core.so.5.0.0 to libQt5Core.so.5.7.0. You can deploy Qt binaries as well, but it starts to get really painful if there's a change in one of the underlying libraries the Qt platform integration plugins depend on. Same problem with static builds, you can't build the kernel API statically, right, plus you get one big monster executable and you need to initialize the plugins Qt uses manually from code (which Qt does automagically when the loader loads the corresponding .so). Just my 2 cents.

            If you still decide to walk the "deploy Qt binaries" way then the Qt documentation provides a relatively comprehensive text, as you've already found out, on how to do it.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Simon Platten
              wrote on 21 Sept 2016, 13:32 last edited by Simon Platten
              #9

              Now I'm confused, what are you saying...I have built at least 4 RedHat 7.2 systems and none of these had the Qt shared object libraries after the install. This is why we are looking at static builds.

              I've just relinked our application with the static libraries and I get:

              This application failed to start because it could not find or load the Qt platform plugin "xcb"
              in "".

              Reinstalling the application may fix this problem.
              Aborted (core dumped)

              [Edit] I've run ldd on the application and noted the referneced libraries, I added all these to the project but it still comes up with the same error.

              Kind Regards,
              Simon Platten

              K 1 Reply Last reply 21 Sept 2016, 13:51
              0
              • S Simon Platten
                21 Sept 2016, 13:32

                Now I'm confused, what are you saying...I have built at least 4 RedHat 7.2 systems and none of these had the Qt shared object libraries after the install. This is why we are looking at static builds.

                I've just relinked our application with the static libraries and I get:

                This application failed to start because it could not find or load the Qt platform plugin "xcb"
                in "".

                Reinstalling the application may fix this problem.
                Aborted (core dumped)

                [Edit] I've run ldd on the application and noted the referneced libraries, I added all these to the project but it still comes up with the same error.

                K Offline
                K Offline
                kshegunov
                Moderators
                wrote on 21 Sept 2016, 13:51 last edited by
                #10

                @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

                none of these had the Qt shared object libraries after the install.

                Have you installed Qt from the distribution's repository? I work on Debian (testing), here's what I have for Qt, all precompiled and ready to be installed.

                This application failed to start because it could not find or load the Qt platform plugin "xcb"
                in "".

                As I said, with static linkage the plugins must be loaded from code.

                Look here and here for more info. It should be enough to add:

                CONFIG += static
                

                for your application, so I'd start there.

                Kind regards.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  Simon Platten
                  wrote on 21 Sept 2016, 13:55 last edited by Simon Platten
                  #11

                  Thank you, will look into this....

                  hmm...I found one post from last year:

                  https://blog.qt.io/blog/2015/06/24/qt-is-coming-to-red-hat-enterprise-linux/

                  However there isn't any recent activity on this and I'm not sure that Qt5.6 libraries are available from any repositories.

                  Kind Regards,
                  Simon Platten

                  K 1 Reply Last reply 21 Sept 2016, 15:18
                  0
                  • S Simon Platten
                    21 Sept 2016, 13:55

                    Thank you, will look into this....

                    hmm...I found one post from last year:

                    https://blog.qt.io/blog/2015/06/24/qt-is-coming-to-red-hat-enterprise-linux/

                    However there isn't any recent activity on this and I'm not sure that Qt5.6 libraries are available from any repositories.

                    K Offline
                    K Offline
                    kshegunov
                    Moderators
                    wrote on 21 Sept 2016, 15:18 last edited by
                    #12

                    @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

                    However there isn't any recent activity on this and I'm not sure that Qt5.6 libraries are available from any repositories.

                    I can't say, sorry. You may be right that there isn't a prebuilt binary, I never cared much for the RedHat family, so I'm not up to date.

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Simon Platten
                      wrote on 21 Sept 2016, 15:59 last edited by
                      #13

                      I have no choice the company I'm contracting to required a licensed version of Linux.

                      Kind Regards,
                      Simon Platten

                      K 1 Reply Last reply 21 Sept 2016, 16:02
                      0
                      • S Simon Platten
                        21 Sept 2016, 15:59

                        I have no choice the company I'm contracting to required a licensed version of Linux.

                        K Offline
                        K Offline
                        kshegunov
                        Moderators
                        wrote on 21 Sept 2016, 16:02 last edited by kshegunov
                        #14

                        @Simon-Platten said in Building Qt as static libraries and linking on RedHat 7.2:

                        I have no choice the company I'm contracting to required a licensed version of Linux.

                        I didn't mean to imply that you should switch, I only meant that I am not up to date with RedHat and what it provides.

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          Simon Platten
                          wrote on 21 Sept 2016, 17:01 last edited by
                          #15

                          Thats ok, no offence taken :)

                          Kind Regards,
                          Simon Platten

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 21 Sept 2016, 22:07 last edited by
                            #16

                            Hi,

                            Just in case, there's a WIP tool available here which goal is to be integrated in Qt in the long run.

                            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

                            K 1 Reply Last reply 21 Sept 2016, 22:15
                            0
                            • S SGaist
                              21 Sept 2016, 22:07

                              Hi,

                              Just in case, there's a WIP tool available here which goal is to be integrated in Qt in the long run.

                              Hope it helps

                              K Offline
                              K Offline
                              kshegunov
                              Moderators
                              wrote on 21 Sept 2016, 22:15 last edited by
                              #17

                              @SGaist
                              This is so new and fresh, I love it. I'll consider making a few pull requests in the near future. :)

                              Read and abide by the Qt Code of Conduct

                              1 Reply Last reply
                              0

                              13/17

                              21 Sept 2016, 15:59

                              • Login

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