Compiling Qt 3.1.1

Michael Stout kde-cygwin@mail.kde.org
Tue, 18 Feb 2003 18:05:15 -0800


For the hell of it I'm trying to compile Qt 3.1.1 from trolltech's 
sources and got to a point where I am having trouble linking libqjpeg.dll.

I note this quote in the faqs

"here are some patches caused by the auto-import concept (basically this 
is a problem of the windows runtime concept), which prohibits 
referencing to global vars in dll's with an offset != 0. These patches 
has to be applied to all further kde/qt releases (if compiled with g++) 
and they are possibly candidates for applying to the kde tree."

Do you have any more info?

I noticed that you have a binutils patch.  Do you still need that or has
that patch been incorporated into binutils.

Just about the only thing I did was implement getlogin_r in cygwin.

By the way.  Heres my problem.

g++ -c -pipe -fno-exceptions -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG 
-DQT_THREAD_SUPPORT -DQT_PLUGIN -DQT_SHARED 
-I/usr/src/qt-x11-free-3.1.1/mkspecs/cygwin-g++ -I. 
-I../../../../include -I.moc/release-shared-mt/ -o 
.obj/release-shared-mt/main.o main.cpp
main.cpp: In member function `virtual bool JPEGFormat::loadImage(const
    QString&, const QString&, QImage*)':
main.cpp:45: warning: unused parameter `const QString&format'
main.cpp:45: warning: unused parameter `const QString&filename'
main.cpp:45: warning: unused parameter `QImage*image'
main.cpp: In member function `virtual bool JPEGFormat::saveImage(const
    QString&, const QString&, const QImage&)':
main.cpp:60: warning: unused parameter `const QString&format'
main.cpp:60: warning: unused parameter `const QString&filename'
main.cpp:60: warning: unused parameter `const QImage&image'
main.cpp: In member function `virtual bool 
JPEGFormat::installIOHandler(const
    QString&)':
main.cpp:75: warning: unused parameter `const QString&name'
test -d ../../../imageformats/ || mkdir -p ../../../imageformats/
rm -f libqjpeg.dll
g++ -fno-exceptions -shared -Wl,-soname,libqjpeg.dll.1 
-Wl,-rpath,/usr/src/qt-x11-free-3.1.1/plugins/imageformats -o 
libqjpeg.dll .obj/release-shared-mt/main.o 
-Wl,-rpath,/usr/src/qt-x11-free-3.1.1/lib 
-L/usr/src/qt-x11-free-3.1.1/lib -L/usr/X11R6/lib -ljpeg -lqt-mt -lpng 
-lz -lXrender -lXext -lX11 -lSM -lICE -lpthread
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x0):fake: multiple 
definition of `___do_frame_init'
/usr/lib/gcc-lib/i686-pc-cygwin/3.2/crtbegin.o(.text+0x0): first defined 
here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x30):fake: multiple 
definition of `___do_frame_fini'
/usr/lib/gcc-lib/i686-pc-cygwin/3.2/crtbegin.o(.text+0x30): first 
defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x42c1a0): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of 
`QValueListPrivate<QString>::QValueListPrivate[in-charge]()'
.obj/release-shared-mt/main.o(.text$_ZN17QValueListPrivateI7QStringEC1Ev+0x0):main.cpp: 
first defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x441ee0): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `QImageFormatPlugin::metaObject() const'
.obj/release-shared-mt/main.o(.text$_ZNK18QImageFormatPlugin10metaObjectEv+0x0):main.cpp: 
first defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.data+0x30c8): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo for Qt'
.obj/release-shared-mt/main.o(.data$_ZTI2Qt+0x0):main.cpp: first defined 
here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x4458c0): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo name for QObject'
.obj/release-shared-mt/main.o(.text$_ZTS7QObject+0x0):main.cpp: first 
defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x444b10): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo name for QImageFormatPlugin'
.obj/release-shared-mt/main.o(.text$_ZTS18QImageFormatPlugin+0x0):main.cpp: 
first defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.data+0x3438): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo for QObject'
.obj/release-shared-mt/main.o(.data$_ZTI7QObject+0x0):main.cpp: first 
defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x445408): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo name for Qt'
.obj/release-shared-mt/main.o(.text$_ZTS2Qt+0x0):main.cpp: first defined 
here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.data+0x2c30): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo for QImageFormatPlugin'
.obj/release-shared-mt/main.o(.data$_ZTI18QImageFormatPlugin+0x0):main.cpp: 
first defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.rdata+0x0): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `___EH_FRAME_BEGIN__'
/usr/lib/gcc-lib/i686-pc-cygwin/3.2/crtbegin.o(.eh_frame+0x0): first 
defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.text+0x445980): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo name for QGPlugin'
.obj/release-shared-mt/main.o(.text$_ZTS8QGPlugin+0x0):main.cpp: first 
defined here
/usr/src/qt-x11-free-3.1.1/lib/libqt-mt.dll(.data+0x35b8): In function 
`cygwin_premain0':
/cygdrive/c/cyg/obj/i686-pc-cygwin/winsup/cygwin/../../../../src/winsup/cygwin/lib/premain0.c:14: 
multiple definition of `typeinfo for QGPlugin'
.obj/release-shared-mt/main.o(.data$_ZTI8QGPlugin+0x0):main.cpp: first 
defined here
Cannot export etext: symbol not found
collect2: ld returned 1 exit status
make: *** [../../../imageformats/libqjpeg.dll] Error 1
/usr/src/qt-x11-free-3.1.1/plugins/src/imageformats/jpeg>


I munged qt-x11-free-3.1.1/plugins/src/imageformats/jpeg/main.cpp so 
that just about everyting is stubbed

#ifndef QT_CLEAN_NAMESPACE
#define QT_CLEAN_NAMESPACE
#endif
#include <qimageformatplugin.h>

#ifndef QT_NO_IMAGEFORMATPLUGIN

#ifdef QT_NO_IMAGEIO_JPEG
#undef QT_NO_IMAGEIO_JPEG
#endif
//#include "../../../../src/kernel/qjpegio.cpp"

#include <qimage.h>
#include <jpeglib.h>

class JPEGFormat : public QImageFormatPlugin
{
public:
     JPEGFormat();

     QStringList keys() const;
     bool loadImage( const QString &format, const QString &filename, 
QImage * );
     bool saveImage( const QString &format, const QString &filename, 
const QImage & );
     bool installIOHandler( const QString & );
};

JPEGFormat::JPEGFormat()
{
}

QStringList JPEGFormat::keys() const
{
     QStringList list;
     return list;
}

bool JPEGFormat::loadImage( const QString &format, const QString 
&filename, QImage *image )
{
     return TRUE;
}

bool JPEGFormat::saveImage( const QString &format, const QString 
&filename, const QImage &image )
{
     return TRUE;
}

bool JPEGFormat::installIOHandler( const QString &name )
{
     return TRUE;
}

Q_EXPORT_PLUGIN( JPEGFormat )

#endif // QT_NO_IMAGEFORMATPLUGIN