views:

105

answers:

1

I'd like to compile a static version of the Qt toolkit on the Windows platform (Windows XP SP3). I downloaded the latest release for Windows and successfully installed it. Then I opened the Qt 4.6.3 Command Prompt from the Start menu and invoked:

configure -static -release -nomake examples -nomake demos -fast

Configuration executes fine, and the first part of mingw32-make as well. At some point I get a lot of undefined references:

mingw32-make[4]: Entering directory `C:/Qt-static/4.6.3/src/tools/moc'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_MOC -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_TEXTCODEC -DQT_NO_CAST_FROM_AS CII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTST REAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NODLL -I" ." -I"." -I"......\include" -I"......\include\QtCore" -I"......\include\Qt Xml" -I"....\xml" -I"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1. 1\include" -I"......\mkspecs\win32-g++" -o release\moc.o moc.cpp

...

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o ......\bin\moc.exe release/m oc.o release/preprocessor.o release/generator.o release/parser.o release/token.o release/main.o -L"c:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\ Lib\" -LC:/Qt-static/4.6.3/src/tools/bootstrap/release -lbootstrap -luser32 release/moc.o:moc.cpp:(.text+0x14b): undefined reference to QByteArray::shared_ null'
release/moc.o:moc.cpp:(.text+0x150): undefined reference to
QByteArray::shared_ null'
release/moc.o:moc.cpp:(.text+0x156): undefined reference to `QByteArray::shared_

...

The list of undefined references is actually much longer.

This is out of the box on a pretty default Windows installation. I wonder whether I'm doing something wrong or there's a bug in the toolkit.

A: 

I had similar problems. In my case Visual Studio had set environment parameters
INCLUDE and LIB which confused the make.

The solution was to disable them from the command line

set INCLUDE=
set LIB=

before compiling the Qt libraries.

Nick D
Yeah, this is a good candidate for causing the problem: the -I".NET 2003..." flag also got me thinking that there was a mixup of mingw and msvc libraries/headers.
rubenvb