PDA

View Full Version : Static compile with jpg support



ksqt
11th March 2006, 17:56
Can I do a static compile with open source version and still get jpg support for the app?

wysota
13th March 2006, 10:24
Yes. You have to compile jpg support into the library itself (not as a plugin).

zlatko
13th March 2006, 10:25
Are you can use jpg in dynamic compile with open source version ? If yes so i think you can do it with static compile

ksqt
13th March 2006, 15:33
Yes. You have to compile jpg support into the library itself (not as a plugin).
Sorry for the newbie questions, but, how do i go about doing this?

wysota
13th March 2006, 15:52
Depends on which Qt version you use. For Qt4 it should be enough to compile Qt in static mode (check FAQ for details) and to use libjpeg which comes with Qt (or to have a static libjpeg installed in the system). For Qt3 (AFAIR) there was some switch to compile jpeg support directly into Qt. Run configure with "-help" parameter and look for it.

ksqt
13th March 2006, 16:01
I'm using Qt 4.1.1. With the open source version for windows(installed with the .exe) my program works fine. I can manipulate, etc. jpeg images. But if I try the open source "source" and build it, I cannot work with jpeg images. (configure -static)
Perhaps I am missing a switch during "configure"...:confused:

Also, how do I use "libjpeg"?

wysota
13th March 2006, 16:31
-no-libjpeg ........ Do not compile the plugin for JPEG support.
-qt-libjpeg ........ Use the libjpeg bundled with Qt.
-system-libjpeg .... Use libjpeg from the operating system. See http://www.ijg.org

ksqt
13th March 2006, 17:07
-no-libjpeg ........ Do not compile the plugin for JPEG support.
-qt-libjpeg ........ Use the libjpeg bundled with Qt.
-system-libjpeg .... Use libjpeg from the operating system. See http://www.ijg.org
ah...that is "libjpeg"...
I have already tried that "configure -static -release -qt-libjpeg" and built, but the program will not work. (identical program with shared works :confused: )

wysota
13th March 2006, 18:05
Check if Qt builds a static libjpeg library. If not, this could be a bug and should be reported to TT.

ksqt
13th March 2006, 21:44
Check if Qt builds a static libjpeg library. If not, this could be a bug and should be reported to TT.
Where would I check to see if it did build a "libjpeg" library?
Sorry for such newbee-ish questions....:o

wysota
13th March 2006, 22:18
Probably somewhere around src/3rdparty/libjpeg directory relative to unpacked Qt source :)

ksqt
13th March 2006, 22:27
src\3rdparty\libjpeg exists.......so.......?

wysota
14th March 2006, 00:26
So nothing :) check if Qt compiles a static version of the library when you pass -static and -qt-libjpeg to configure and start compilation. If you have problems, use Google. After all, this is Qt devoted forum not a "general compilation issues" one.

ksqt
14th March 2006, 15:44
Qt builds just fine with configure -release -static -qt-libjpeg
Only thing is, I cannot get a program to work that manipulates, opens, saves, etc. a jpg....
It compiles fine, it just gives an error when trying to open a jpg.
The exact same code works when using Qt as shared, though....

It's no big deal, I am just testing the waters against MFC (my "limited" background)

wysota
14th March 2006, 15:59
I know Qt builds fine. But after that build is completed, check if a static version of libjpeg was built (it should be in the directory already mentioned) -- it'll probably be called libjpeg.a or jpeg.a or something like that... I don't know Windows naming schemes for static libraries (but it surely won't have a "dll" extension).

ksqt
14th March 2006, 16:05
Thanks....
There is not any file there with that name....
However in \plugins\imageformats there is a "libqjpeg.a"....
Perhaps this is what I need? If so, how to use?

Again, I thank you for your perserverance....:)

wysota
14th March 2006, 16:54
Yes, this might be what you need (it's a static version of the image plugin). You need to link your application with it. Consult QMake reference for details.

ksqt
15th March 2006, 15:26
In the .pro file I added:
win32:LIBS += path\to\thelibrary
but that still did not work......
Any idea if I am on the right track here.:o

tiva
11th May 2007, 05:43
Either pass the path of the .a file or copy the .a file to your working folder and
add the following lines to your .pro file.


LIBS += -L . -lqjpeg

Along with the Qt Assistant notes for compling static plugins into your app, this should help u accomplish your task.