Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2008
qmake bug?


Message 1 in thread

I was trying to make a static link of my application to distribute it
without the dll's

So I recompiled Qt in static without issues.

My application was not loading jpegs anymore. So I added QTPLUGIN += qjpeg
in the .pro, and I added Q_IMPORT_PLUGIN(qjpeg)
I got a link error : undefined reference to qt_plugin_instance_qjpeg

By looking to the makefile, I saw that it was linking to -lqjpeg4, which
seems to be a shared library. I added -lqjpeg to the makefile, and
everything works perfectly.

Why is qmake linking to libqjpeg4 ?

Etienne

Message 2 in thread

You can't use plugins with a statically compiled Qt. You have to compile JPEG 
support into the Qt library.

Bo.

On tirsdag den 11. Marts 2008, Etienne Sandré wrote:
> I was trying to make a static link of my application to distribute it
> without the dll's
>
> So I recompiled Qt in static without issues.
>
> My application was not loading jpegs anymore. So I added QTPLUGIN += qjpeg
> in the .pro, and I added Q_IMPORT_PLUGIN(qjpeg)
> I got a link error : undefined reference to qt_plugin_instance_qjpeg
>
> By looking to the makefile, I saw that it was linking to -lqjpeg4, which
> seems to be a shared library. I added -lqjpeg to the makefile, and
> everything works perfectly.
>
> Why is qmake linking to libqjpeg4 ?
>
> Etienne



-- 
 [ signature omitted ] 

Message 3 in thread

Make sure the jpeg capability is set to build in your qt configurationâ

 

This works fine, I have a couple of projects I use that build in the qjpeg (and other image plugins) statically.

 

If you can post the config.status and your project file and a simple main.cpp that uses the Q_IMPORT_PLUGIN macro I can take a look for you.

 

Scott

 

From: etienne.sandre.chardonnal@xxxxxxxxx [mailto:etienne.sandre.chardonnal@xxxxxxxxx] On Behalf Of Etienne SandrÃ
Sent: Tuesday, March 11, 2008 12:44 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: qmake bug?

 

I was trying to make a static link of my application to distribute it without the dll's

So I recompiled Qt in static without issues.

My application was not loading jpegs anymore. So I added QTPLUGIN += qjpeg in the .pro, and I added Q_IMPORT_PLUGIN(qjpeg)
I got a link error : undefined reference to qt_plugin_instance_qjpeg

By looking to the makefile, I saw that it was linking to -lqjpeg4, which seems to be a shared library. I added -lqjpeg to the makefile, and everything works perfectly.

Why is qmake linking to libqjpeg4 ?

Etienne


Message 4 in thread

>
> ** <etienne.sandre.chardonnal@xxxxxxxxx>
>
To Bo : Yes, you can. This is what Q_IMPORT_PLUGIN is made for, and this
macro is useless for shared Qt.

To Scott : Yes, the jpeg is set to build, and the library libqjpeg.a is
created. Everything works perfectly if I link manually with this library.
But qmake generated Makefile links with libqjpeg4.a which strongly looks
like a shared library.

Were is generated config.status? (But I'm sure jpeg support is enabled in
configure)

The .pro file:

TEMPLATE = app
TARGET = Mapiki_Editor

QT        += core gui xml network opengl

CONFIG += qt debug_and_release
win32:debug {
       CONFIG += console
  }

QTPLUGIN += qjpeg

HEADERS   += source/gui/MapikiEditor.h \
    source/gui/MapView.h \
    source/gui/Selection.h \
    source/gui/imagemaps/ImageMap.h \
    source/map/Id.h \
    source/map/MapData.h \
    source/map/MapDataReader.h \
    source/map/Node.h \
    source/map/EarthPos.h \
    source/map/MapObject.h \
    source/map/MapPoint.h \
    source/map/MapLine.h \
    source/map/MapArea.h \
    source/map/Flags.h \
    source/gui/PaintOptions.h \
    source/map/Vector.h \
    source/map/QuadTree.h \
    source/gui/TagList.h \
    source/gui/ListBox.h \
    source/prefs/PrefDialog.h \
    source/misc/IODecompressor.h

SOURCES   += source/main.cpp \
    source/gui/MapikiEditor.cpp \
    source/gui/MapView.cpp \
    source/gui/Selection.cpp \
     source/gui/imagemaps/ImageMap.cpp \
    source/map/Id.cpp \
    source/map/MapData.cpp \
    source/map/MapDataReader.cpp \
    source/map/EarthPos.cpp \
    source/map/Vector.cpp \
    source/map/MapObject.cpp \
    source/map/MapPoint.cpp \
    source/map/MapLine.cpp \
    source/map/MapArea.cpp \
    source/map/QuadTree.cpp \
    source/gui/TagList.cpp \
    source/gui/ListBox.cpp \
    source/prefs/PrefDialog.cpp \
    source/misc/IODecompressor.cpp


FORMS     += source/gui/mapiki_editor.ui \
    source/prefs/prefdialog.ui
RESOURCES += resources/resources.qrc
INCLUDEPATH += source
LIBS += -lz


My main.cpp:
#include "gui/MapikiEditor.h"

#include <QtGui>
#include <QApplication>
#include <QCoreApplication>

Q_IMPORT_PLUGIN(qjpeg)

int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("Galinette");
    QCoreApplication::setOrganizationDomain("www.galinette.org");
    QCoreApplication::setApplicationName("Mapiki Editor");

//QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
    QApplication a(argc, argv);

    MapikiEditor w;
    w.show();
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));


    return a.exec();
}




In order for the link to work, I must add LIBS+=lqjpeg to the .pro file
otherwise I get an error (some symbol is unresolved)


Etienne

Message 5 in thread

Hi,

To me, this looks like you have done something odd when setting up your 
compilation. You should not need to add the jpeg library to the link list 
manually.

I don't believe it's a qt/qmake bug, because this works for everyone else. But 
it's impossible to say what it is exactly that has happened.

My advice would be to just forget it for now, and keep working. You now have a 
working workaround, and I will bet you that one day (after installing a new 
Qt) you will find that it's no longer necessary. I think you will be wasting 
your time trying to figure out what exactly went odd here.

Bo.

On fredag den 14. Marts 2008, Etienne Sandré wrote:
> > ** <etienne.sandre.chardonnal@xxxxxxxxx>
>
> To Bo : Yes, you can. This is what Q_IMPORT_PLUGIN is made for, and this
> macro is useless for shared Qt.
>
> To Scott : Yes, the jpeg is set to build, and the library libqjpeg.a is
> created. Everything works perfectly if I link manually with this library.
> But qmake generated Makefile links with libqjpeg4.a which strongly looks
> like a shared library.
>
> Were is generated config.status? (But I'm sure jpeg support is enabled in
> configure)
>
> The .pro file:
>
> TEMPLATE = app
> TARGET = Mapiki_Editor
>
> QT        += core gui xml network opengl
>
> CONFIG += qt debug_and_release
> win32:debug {
>        CONFIG += console
>   }
>
> QTPLUGIN += qjpeg
>
> HEADERS   += source/gui/MapikiEditor.h \
>     source/gui/MapView.h \
>     source/gui/Selection.h \
>     source/gui/imagemaps/ImageMap.h \
>     source/map/Id.h \
>     source/map/MapData.h \
>     source/map/MapDataReader.h \
>     source/map/Node.h \
>     source/map/EarthPos.h \
>     source/map/MapObject.h \
>     source/map/MapPoint.h \
>     source/map/MapLine.h \
>     source/map/MapArea.h \
>     source/map/Flags.h \
>     source/gui/PaintOptions.h \
>     source/map/Vector.h \
>     source/map/QuadTree.h \
>     source/gui/TagList.h \
>     source/gui/ListBox.h \
>     source/prefs/PrefDialog.h \
>     source/misc/IODecompressor.h
>
> SOURCES   += source/main.cpp \
>     source/gui/MapikiEditor.cpp \
>     source/gui/MapView.cpp \
>     source/gui/Selection.cpp \
>      source/gui/imagemaps/ImageMap.cpp \
>     source/map/Id.cpp \
>     source/map/MapData.cpp \
>     source/map/MapDataReader.cpp \
>     source/map/EarthPos.cpp \
>     source/map/Vector.cpp \
>     source/map/MapObject.cpp \
>     source/map/MapPoint.cpp \
>     source/map/MapLine.cpp \
>     source/map/MapArea.cpp \
>     source/map/QuadTree.cpp \
>     source/gui/TagList.cpp \
>     source/gui/ListBox.cpp \
>     source/prefs/PrefDialog.cpp \
>     source/misc/IODecompressor.cpp
>
>
> FORMS     += source/gui/mapiki_editor.ui \
>     source/prefs/prefdialog.ui
> RESOURCES += resources/resources.qrc
> INCLUDEPATH += source
> LIBS += -lz
>
>
> My main.cpp:
> #include "gui/MapikiEditor.h"
>
> #include <QtGui>
> #include <QApplication>
> #include <QCoreApplication>
>
> Q_IMPORT_PLUGIN(qjpeg)
>
> int main(int argc, char *argv[])
> {
>     QCoreApplication::setOrganizationName("Galinette");
>     QCoreApplication::setOrganizationDomain("www.galinette.org");
>     QCoreApplication::setApplicationName("Mapiki Editor");
>
> //QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());
>     QApplication a(argc, argv);
>
>     MapikiEditor w;
>     w.show();
>     a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
>
>
>     return a.exec();
> }
>
>
>
>
> In order for the link to work, I must add LIBS+=lqjpeg to the .pro file
> otherwise I get an error (some symbol is unresolved)
>
>
> Etienne



-- 
 [ signature omitted ]