Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building Qt as a static
Forum Updated to NodeBB v4.3 + New Features

Building Qt as a static

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 2 Posters 3.6k Views 2 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.
  • G Offline
    G Offline
    gmahan
    wrote on last edited by
    #1

    I am trying to build Qt, on my Fedora 21 x64, as a static libraries so I can build my application to link against the static libraries. I have followed the instructions on this blog :https://wiki.qt.io/Building_Qt_5_from_Git, and have successfully compiled the qt source libraries. I tried to build an application from the examples directory and everything compiled fine. But I get the following error when trying to run the application:

    This application failed to start because it could not find or load the Qt platform plugin "xcb".
    Reinstalling the application may fix this problem.

    I have already installed the xcb-util package.

    #yum install xcb-util
    Loaded plugins: langpacks
    Package xcb-util-0.4.0-2.fc21.x86_64 already installed and latest version
    Nothing to do

    [gmahan@localhost platforms]$ pwd
    /home/gmahan/qt5/qtbase/plugins/platforms
    [gmahan@localhost platforms]$ ls
    libqlinuxfb.a libqminimal.a libqoffscreen.a libqxcb.a libqlinuxfb.prl libqminimal.prl libqoffscreen.prl libqxcb.prl

    I'm not sure how to proceed. I haven't found how to resolve this after reading a few similar problems.

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

      Hi,

      Static plugins need special handling, see Q_IMPORT_PLUGIN for more information.

      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
      • G Offline
        G Offline
        gmahan
        wrote on last edited by
        #3

        @SGaist Thanks for pointing this out.

        After reading a bit I added the following to the .pro and the main.cpp file.

        TEMPLATE = app
        LIBS += /home/gmahan/qt5/qtbase/plugins/platforms/libqxcb.a
        

        In main.cpp, I added the following:

         #include <QApplication>
         #include <QtPlugin>
         #include "mapzoom.h"
        
         Q_IMPORT_PLUGIN(qxcb)
        

        Gave me the following error in make:

        /home/gmahan/qt5/qtbase/examples/embedded/lightmaps/main.cpp:46: undefined reference to `qt_static_plugin_qxcb()

        But according to http://doc.qt.io/qt-5/plugins-howto.html#static-plugins, all I need is

        QTPLUGIN += qxcb
        

        The above line gave me the following warning :

        Project WARNING: Redundant entries in QTPLUGIN: qxcb

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

          Aren't you missing a -l in your LIBS line ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          0
          • SGaistS SGaist

            Aren't you missing a -l in your LIBS line ?

            G Offline
            G Offline
            gmahan
            wrote on last edited by
            #5

            @SGaist Didn't think that was necessary for static libraries, works in my other project without the -L for static libs, but I'll try it nevertheless.

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

              not -L -l. -L is to add entries to the folder list the linker will search into

              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