[Qt-interest] Static Qt Compile on Windows

A. S. Budden abudden at gmail.com
Mon Sep 6 13:19:47 CEST 2010


Dear all,

I've been trying to compile Qt statically on Windows XP and have been
having some issues.  The problem seems to be related to the static
compilation and the image plugins.  I was following the instructions
on these two (very helpful) pages:

    http://www.formortals.com/how-to-statically-link-qt-4/
    http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/

I configured Qt using the following command (configuration report
shown at the bottom of this email - note the "JPEG
support............plugin" - I haven't found a set of configuration
options that change this to "yes"):

    C:\al\qt-everywhere-opensource-src-4.7.0-rc1>configure -static
-opensource -platform win32-g++ -release  -nomake examples -nomake
demos -no-exceptions  -no-stl -no-rtti -no-qt3support -no-scripttools
-no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif
-no-style-cde -no-style-cleanlooks -no-style-plastique -no-sql-sqlite
-qt-libjpeg -qt-zlib -qt-libpng -qt-gif

When I ran mingw32-make, the compile proceeded for a while and exited
with the following errors:

    g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-subsystem,windows -o
..\..\..\..\bin\assistant.exe object_script.assistant.Release
-L"c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib"
-L"c:\al\qt-everywhere-opensource-src-4.7.0-rc1\plugins\sqldrivers"
-L"c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib" -lmingw32
-lqtmain tmp\obj\release_static\assistant_res.o -lQtHelp -lQtSql
-lQtXml -lQtGui -lQtNetwork -lQtCLucene -lgdi32 -lcomdlg32 -loleaut32
-limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32 -luser32
-lshell32 -luuid -lole32 -ladvapi32 -lws2_32
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagewriter.o):qimagewriter.cpp:(.text+0xa14):
undefined reference to `QJpegHandler::QJpegHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagewriter.o):qimagewriter.cpp:(.text+0xa2f):
undefined reference to `QMngHandler::QMngHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagewriter.o):qimagewriter.cpp:(.text+0xa76):
undefined reference to `QTiffHandler::QTiffHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0xd5c):
undefined reference to `QJpegHandler::QJpegHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0xd77):
undefined reference to `QMngHandler::QMngHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0xdbe):
undefined reference to `QTiffHandler::QTiffHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x1187):
undefined reference to `QJpegHandler::canRead(QIODevice*)'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x11a5):
undefined reference to `QJpegHandler::QJpegHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x11b2):
undefined reference to `QMngHandler::canRead(QIODevice*)'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x11d0):
undefined reference to `QMngHandler::QMngHandler()'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x11dd):
undefined reference to `QTiffHandler::canRead(QIODevice*)'
    c:\al\qt-everywhere-opensource-src-4.7.0-rc1\lib/libQtGui.a(qimagereader.o):qimagereader.cpp:(.text+0x11fb):
undefined reference to `QTiffHandler::QTiffHandler()'
    collect2: ld returned 1 exit status
    mingw32-make[5]: *** [..\..\..\..\bin\assistant.exe] Error 1


I've tried this both with 4.6.3
(qt-everywhere-opensource-src-4.6.3.zip from the nokia site) and the
4.7.0-rc1 release candidate (although I had to copy configure.exe from
4.6.3 to 4.7.0 as it was missing from the tar.gz I downloaded: the
.zip file didn't download correctly for 4.7.0-rc1).

Can anyone suggest what I might be doing wrong?

Many thanks in advance,

Al

Configuration Output (excluding licence stuff, syncqt and qmake
compilation) is below.  The syncqt and qmake compilation output is
available here: http://pastebin.com/FGDj0ASn

Environment:
    INCLUDE=
      Unset
    LIB=
      Unset
    PATH=
      c:\applications\development\qt\mingw\bin
      C:\applications\development\libraries\gtk\bin
      c:\applications\development\qt\qt\bin
      [snip]

You are licensed to use this software under the terms of the GNU GPL
version 3.You are licensed to use this software under the terms of the
Lesser GNU LGPL version 2.1.
See C:/al/qt-everywhere-opensource-src-4.7.0-rc13

 or C:/al/qt-everywhere-opensource-src-4.7.0-rc1L

Configuration:
    minimal-config
    small-config
    medium-config
    large-config
    full-config
    release
Qt Configuration:
    release
    zlib
    gif
    png
    accessibility
    s60
    ipv6
    script
    multimedia
    audio-backend
    native-gestures
    svg
    minimal-config
    small-config
    medium-config
    large-config
    full-config

QMAKESPEC...................win32-g++ (commandline)
Architecture................windows
Maketool....................mingw32-make
Debug symbols...............no
Link Time Code Generation...no
Accessibility support.......yes
STL support.................no
Exception support...........no
RTTI support................no
MMX support.................no
3DNOW support...............no
SSE support.................no
SSE2 support................no
IWMMXT support..............no
OpenGL support..............no
OpenVG support..............no
OpenSSL support.............no
QtDBus support..............no
QtXmlPatterns support.......no
Phonon support..............no
QtMultimedia support........yes
WebKit support..............no
Declarative support.........no
QtScript support............yes
QtScriptTools support.......no
Graphics System.............raster
Qt3 compatibility...........no

Third Party Libraries:
    ZLIB support............qt
    GIF support.............yes
    TIFF support............plugin
    JPEG support............plugin
    PNG support.............qt
    MNG support.............plugin
    FreeType support........no

Styles:
    Windows.................yes
    Windows XP..............yes
    Windows Vista...........yes
    Plastique...............no
    Cleanlooks..............no
    Motif...................no
    CDE.....................no
    Windows CE..............no
    Windows Mobile..........no
    S60.....................no

Sql Drivers:
    ODBC....................no
    MySQL...................no
    OCI.....................no
    PostgreSQL..............no
    TDS.....................no
    DB2.....................no
    SQLite..................no (qt)
    SQLite2.................no
    InterBase...............no

Sources are in..............C:\al\qt-everywhere-opensource-src-4.7.0-rc1
Build is done in............C:\al\qt-everywhere-opensource-src-4.7.0-rc1
Install prefix..............C:\al\qt-everywhere-opensource-src-4.7.0-rc1
Headers installed to........C:/al/qt-everywhere-opensource-src-4.7.0-rc1/include
Libraries installed to......C:/al/qt-everywhere-opensource-src-4.7.0-rc1/lib
Plugins installed to........C:/al/qt-everywhere-opensource-src-4.7.0-rc1/plugins
Binaries installed to.......C:/al/qt-everywhere-opensource-src-4.7.0-rc1/bin
Docs installed to...........C:/al/qt-everywhere-opensource-src-4.7.0-rc1/doc
Data installed to...........C:/al/qt-everywhere-opensource-src-4.7.0-rc1
Translations installed
to...C:/al/qt-everywhere-opensource-src-4.7.0-rc1/translations
Examples installed
to.......C:/al/qt-everywhere-opensource-src-4.7.0-rc1/examples
Demos installed to..........C:/al/qt-everywhere-opensource-src-4.7.0-rc1/demos

WARNING: Using static linking will disable the use of plugins.
         Make sure you compile ALL needed modules into the library.



More information about the Qt-interest-old mailing list