Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: where/what are static plugins?

  1. #1
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default where/what are static plugins?

    Hello all!

    I've been desperately trying to compile Qt4.3.3 in static mode and I've never gotten the static mode to work. I suspect that I don't know how to build static plugins or I declare them wrong. To be honest with you, I've no clue what they are.
    The main question I need to answer first is: do I have the right plugins. This brings me to asking 3 very general questions.

    With Qt4.3.3 compiled in static mode and using mingw:

    1. Where do the static plugins reside? I'm especially interested in imageformats plugins. Are imageformats plugins supposed to be in "plugins/imageformats"?
    2. What are the names and file extentions of static imageformat plugins (or any other plugins for that matter)? How do I recognize a plugin? I've never had a confirmed sighting of a static plugin in all my years? To me they are UFOs.
    3. Once you pick up a scent of your mysterious static plugin and track it down and corner it and prevent it from escaping, how do you then test if your plugin is functional and built right?

    Yours,
    ht1

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Quote Originally Posted by ht1 View Post
    Where do the static plugins reside? I'm especially interested in imageformats plugins. Are imageformats plugins supposed to be in "plugins/imageformats"?
    In the same place as normal plugins would be, so in case of image format plugins it will be $QTDIR/plugins/imageformats.

    Quote Originally Posted by ht1 View Post
    What are the names and file extentions of static imageformat plugins (or any other plugins for that matter)? How do I recognize a plugin?
    A static plugin is a plugin turned into a static library, so that you can link it with your application. If you use GCC toolchain, they will have .a extension.

    Quote Originally Posted by ht1 View Post
    how do you then test if your plugin is functional and built right?
    If you use the plugin correctly, there should be no linker errors and the plugin should appear in the command line that as -lpluginname. See the documentation for Q_IMPORT_PLUGIN macro.

  3. The following user says thank you to jacek for this useful post:

    ht1 (14th January 2008)

  4. #3
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Thanks. I think I have the static plugins because in the "plugins/imageformats" I have:
    libqgif.a, libqjpeg.a, libqmng.a, libqsvg.a, libqtiff.a.

    In my main.cpp I declare:
    Qt Code:
    1. #include <QtPlugin>
    2. Q_IMPORT_PLUGIN(libqjpeg)
    3. Q_IMPORT_PLUGIN(libqgif)
    4. Q_IMPORT_PLUGIN(libqmng)
    To copy to clipboard, switch view to plain text mode 

    And myproject.pro has:
    Qt Code:
    1. CONFIG += staticlib
    2. QTPLUGIN += libqjpg \
    3. libqgif \
    4. libqmng
    To copy to clipboard, switch view to plain text mode 

    I also put the static plugins files in the same folder with my .pro file. Still the compiler says that "-llibjpg" not found. What I am doing wrong? Compilation works if I don't make the above declarations in the main.cpp and myproject.pro file.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Those plugins are named "qjpeg", "qgif" and "qmng".

  6. The following user says thank you to jacek for this useful post:

    ht1 (14th January 2008)

  7. #5
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    The plugins that I have in my "plugins/imageformats" are not qjpeg, qgif and qmng. They are libqgif.a, libqjpeg.a, libqmng.a, libqsvg.a, libqtiff.a.
    Does that mean I failed to build static plugins?
    How do you build static plugins with mingw?

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Quote Originally Posted by ht1 View Post
    They are libqgif.a, libqjpeg.a, libqmng.a, libqsvg.a, libqtiff.a.
    No these are files with plugins inside. Just remove the "lib" prefix from .pro file and macros in main.cpp.

  9. The following user says thank you to jacek for this useful post:

    ht1 (14th January 2008)

  10. #7
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Jacek, thanks,

    Now myproject.pro is
    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. CONFIG += staticlib
    6. QTPLUGIN += qjpg \
    7. qgif \
    8. qmng
    To copy to clipboard, switch view to plain text mode 
    but I'm still getting "cannot find -lqjpg". I tried to compile with and without this is main.cpp:

    Q_IMPORT_PLUGIN(qjpeg)
    Q_IMPORT_PLUGIN(qgif)
    Q_IMPORT_PLUGIN(qmng)

    but still I get the "cannot find -lqjpg" error.

    Is there anything else I could try to diagnose the problem? Thanks

  11. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    It should be qjpeg.

  12. The following user says thank you to jacek for this useful post:

    ht1 (15th January 2008)

  13. #9
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Thanks, I changed "qjpg" to "qjpeg" in the *.pro file. Now the compiler says:

    main.cpp: undefined reference to 'qt_plugin_instance_qjpeg()'
    main.cpp: undefined reference to 'qt_plugin_instance_qgif()'
    main.cpp: undefined reference to 'qt_plugin_instance_qmng()'

    Is it possible that my static plugins are in the wrong folder? Where do they need to be?

  14. #10
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    I was wondering that perhaps there is something wrong with the way I declare the plugins in my main.cpp. This is how I do it:

    Qt Code:
    1. #include <QtPlugin>
    2.  
    3. Q_IMPORT_PLUGIN(qjpeg)
    4. Q_IMPORT_PLUGIN(qgif)
    5. Q_IMPORT_PLUGIN(qmng)
    To copy to clipboard, switch view to plain text mode 

    Is there anyone out there who has compiled Qt4 statically and has linked imageformat plugins statically to the executable? I have tried just about every combination of everything but nothing works. This problem is causing me a major problems. Thanks!

  15. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Do you use qmake from the static Qt build?

  16. The following user says thank you to jacek for this useful post:

    ht1 (16th January 2008)

  17. #12
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Yes, indeed, I use QMAKE from static Qt build. Also, I am able to incorporate other static plugins no problem, just not the imageformat static plugins. Taking these plugins out makes the program to compile fine but unable to handle image files (because the plugins were not incorporated). So, I think the compiler is fine and the code is fine. It's either that imageformat plugins have a problem, or I do not declare them right, or they are not in the right folder.

  18. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Could you post the command used to link your application (the one where the g++ is invoked with -l options)?

    Do you get any other error messages apart from "undefined reference to qt_plugin_instance_xxx"?

  19. The following user says thank you to jacek for this useful post:

    ht1 (16th January 2008)

  20. #14
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Great, Jacek, you may have figured out what the problem is. I do not know how to link properly using the command line. I've been doing:

    1) prompt>qmake -project
    2) then manually add the plugin info to the myproject.pro as shown in an earlier post
    3) prompt>qmake
    4) prompt>make

    I guess I have to use -l in step 4?? How?
    Thanks again

  21. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Quote Originally Posted by ht1 View Post
    I guess I have to use -l in step 4?? How?
    Actually make should do that for you. What is the last command it runs?

  22. The following user says thank you to jacek for this useful post:

    ht1 (16th January 2008)

  23. #16
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Hi Jacek,

    The last command I run when I compile is
    prompt> make
    I don't know if that's what you meant when you asked about the last command?

    The last thing the compiler does before giving error message is:
    -LC:/Qt/4.3.3/plugins/imageformats/ -lqmng4 -lQtGui -ldgi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws_32
    (hopefully I didn't make mistakes copying it down)
    Last edited by ht1; 16th January 2008 at 22:37.

  24. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Quote Originally Posted by ht1 View Post
    I don't know if that's what you meant when you asked about the last command?
    I asked you about the last command that make runs.

    Run:
    make > aaa.txt
    After make finishes its job, open aaa.txt and find the line with lots of "-l<something>" (it should be near the end of that file) and post it here.

  25. The following user says thank you to jacek for this useful post:

    ht1 (16th January 2008)

  26. #18
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Hi again.

    I didn't find the aaa.txt but
    the last thing the compiler does before giving error message is:

    -LC:/Qt/4.3.3/plugins/imageformats/ -lqmng4 -lQtGui -ldgi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws_32

  27. #19
    Join Date
    Nov 2007
    Posts
    47
    Thanks
    34
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: where/what are static plugins?

    Jacek, you are asking a very good question about the compiler. The compiler says:

    -LC:/Qt/4.3.3/plugins/imageformats/ -lqmng4 -lQtGui -ldgi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws_32

    but my working directory is Qt/static, not Qt/4.3.3. Seems like the system is confused about the folder where imageformat flugins are. What does that mean?

    I just put the imageformat plugins in the folder that compiler wants. Now the error is:
    "cannot find -lqjpeg4"
    Last edited by ht1; 16th January 2008 at 22:56.

  28. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: where/what are static plugins?

    Quote Originally Posted by ht1 View Post
    What does that mean?
    It means that most likely you were using the wrong qmake.

    Run:
    make clean
    C:\Qt\static\bin\qmake
    make

  29. The following user says thank you to jacek for this useful post:

    ht1 (16th January 2008)

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Qt Plugins Error
    By nathanpackard in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2007, 23:19
  3. Accessing to a static variable from the same class
    By xgoan in forum General Programming
    Replies: 6
    Last Post: 5th March 2007, 10:50
  4. static objects in libraries
    By Rawk in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2007, 19:03
  5. Qt4 Plugins How-to
    By Chaid in forum Qt Programming
    Replies: 4
    Last Post: 8th July 2006, 08:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.