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
Re: where/what are static plugins?
Quote:
Originally Posted by
ht1
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
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
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.
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:
Code:
#include <QtPlugin>
Q_IMPORT_PLUGIN(libqjpeg)
Q_IMPORT_PLUGIN(libqgif)
Q_IMPORT_PLUGIN(libqmng)
And myproject.pro has:
Code:
CONFIG += staticlib
QTPLUGIN += libqjpg \
libqgif \
libqmng
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.
Re: where/what are static plugins?
Those plugins are named "qjpeg", "qgif" and "qmng".
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?
Re: where/what are static plugins?
Quote:
Originally Posted by
ht1
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.
Re: where/what are static plugins?
Jacek, thanks,
Now myproject.pro is
Code:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += staticlib
QTPLUGIN += qjpg \
qgif \
qmng
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
Re: where/what are static plugins?
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?
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:
Code:
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)
Q_IMPORT_PLUGIN(qmng)
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!
Re: where/what are static plugins?
Do you use qmake from the static Qt build?
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.
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"?
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
Re: where/what are static plugins?
Quote:
Originally Posted by
ht1
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?
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)
Re: where/what are static plugins?
Quote:
Originally Posted by
ht1
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: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.
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
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"
Re: where/what are static plugins?
Quote:
Originally Posted by
ht1
What does that mean?
It means that most likely you were using the wrong qmake.
Run:
Quote:
make clean
C:\Qt\static\bin\qmake
make
Re: where/what are static plugins?
Hi all,
How to use and build the jpg plugin on QtCreator?
I got the error = undefined reference to `qt_plugin_instance_qjpeg()'
Re: where/what are static plugins?
Quote:
Originally Posted by
vietdoor
Hi all,
How to use and build the jpg plugin on QtCreator?
I got the error = undefined reference to `qt_plugin_instance_qjpeg()'
Hi all
try use Q_IMPORT_PLUGIN(QJPEGPlugin) for Qt 5.0.2 is good ;)