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. Static build fails to include plugins, undefined symbols
Forum Updated to NodeBB v4.3 + New Features

Static build fails to include plugins, undefined symbols

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.9k Views 1 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.
  • M Offline
    M Offline
    mike__b
    wrote on 8 Mar 2012, 14:24 last edited by
    #1

    I've built a static version of Qt for Mac, now I'm trying to build a statically linked application. I need graphics support, so I had planned on using Qt plugins (let me know if this isn't needed / correct) basedon things I had read online.

    I've included <QtPlugin> and Q_IMPORT_PLUGIN statements in my code, and defined QPLUGIN in my .pro file. However, when the final executable is linked, I get the following errors:
    @-L/usr/local/Trolltech/Qt-4.8.0/lib -framework Foundation -framework IOKit -framework AppKit -lQtTest -L/usr/local/Trolltech/Qt-4.8.0/lib -framework Security -framework ApplicationServices -framework CoreFoundation -lQtGui -framework Carbon -lQtCore -lz -lm
    Undefined symbols for architecture x86_64:
    "qt_plugin_instance_qgif()", referenced from:
    global constructors keyed to mainin main.o
    "qt_plugin_instance_qjpeg()", referenced from:
    global constructors keyed to mainin main.o
    "qt_plugin_instance_qico()", referenced from:
    global constructors keyed to mainin main.o
    "qt_plugin_instance_qsvg()", referenced from:
    global constructors keyed to mainin main.o
    "qt_plugin_instance_qtiff()", referenced from:
    global constructors keyed to mainin main.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status@

    /usr/local/Trolltech/Qt-4.8.0/ is the location of my static version of Qt.

    My configure statement for Qt was:
    @./configure -static -release -nomake examples -nomake demos -nomake tools -no-exceptions -stl -no-qt3support -no-script -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-sql-sqlite -arch x86 -arch x86_64 -qt-libjpeg -qt-zlib -qt-libpng -qt-libtiff -qt-freetype -no-dbus -no-cups -no-declarative -no-declarative-debug -no-multimedia -no-accessibility -opensource@

    I'm not sure if I've excluded something important, or if I'm going about this all wrong.

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on 8 Mar 2012, 14:57 last edited by
      #2

      If you want to use plug-ins dynamic linkage is your only option IIRC. Also static linking is only allowed if you have a commercial Qt license.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mike__b
        wrote on 8 Mar 2012, 18:04 last edited by
        #3

        I don't think anything in the GPL or LGPL prevents static linking when the software its is being linked with has a compatible license. My software is not commercial and will be released with the binary.

        As for plugins, I was under the impression it was the opposite, that I needed to include the Qt Plugins for static linking.
        An example of such instruction is here: "http://www.formortals.com/how-to-statically-link-qt-4/":http://www.formortals.com/how-to-statically-link-qt-4/

        So are plugins required to get image support in a statically linked application?

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hmuelner
          wrote on 9 Mar 2012, 13:32 last edited by
          #4

          It's been some time since I have used a static Qt version (and only on Windows), but the problems seems to be that plugins/imageformats/*.lib are not included in your linker command (they should have been added by qmake with the QTPLUGIN command). Can you try manually add -L/usr/local/Trolltech/Qt-4.8.0/plugins/imagesformats and -lqjpeg4 etc. (or similar) to your LIBS specification?

          Helmut Mülner

          1 Reply Last reply
          0

          2/4

          8 Mar 2012, 14:57

          • Login

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