Wednesday, January 27, 2010

Qt 4.6 (2009.05) fails to build: static mingw on Windows

NOTE: This build problem is fixed in 2010.01 (4.6.1). I will be testing this build today.

NOTE: The build is fixed, but I've filed a bug against Widgets due to QLabel unable to setPixmap(). I'd like to have a statically-built app (for general-purpose tools I can share with my team as exe's). Perhaps I'll move back to Qt 5.

Qt Fails to build on 4.6 (2009.05) with configure -static.

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DPHONON_MAKE_QT_ONLY_BACKEND -DQT_STATIC
PLUGIN -DQT_PLUGIN -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\.
.\..\..\include\QtGui" -I"..\..\..\..\include\phonon" -I"..\..\..\..\include" -I"..\..\..\..\include\ActiveQt" -I"..\..\
..\..\include\phonon_compat\phonon" -I"..\..\..\..\include\phonon_compat" -I"..\..\..\..\include\phonon\Phonon" -I"tmp\m
oc\debug_static" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_static\backend.o ..\..\..\3rdparty\phonon\ds9\backen
d.cpp
..\..\..\3rdparty\phonon\ds9\backend.cpp: In static member function 'static QMutex* Phonon::DS9::Backend::directShowMute
x()':
..\..\..\3rdparty\phonon\ds9\backend.cpp:69: error: 'qt_plugin_instance' was not declared in this scope
mingw32-make[4]: *** [tmp/obj/debug_static/backend.o] Error 1
mingw32-make[4]: Leaving directory `C:/Qt/2009.05/qt/src/plugins/phonon/ds9'
mingw32-make[3]: *** [debug-all] Error 2
mingw32-make[3]: Leaving directory `C:/Qt/2009.05/qt/src/plugins/phonon/ds9'
mingw32-make[2]: *** [sub-ds9-make_default] Error 2
mingw32-make[2]: Leaving directory `C:/Qt/2009.05/qt/src/plugins/phonon'
mingw32-make[1]: *** [sub-phonon-make_default] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/2009.05/qt/src/plugins'
mingw32-make: *** [sub-plugins-sub_src_target_ordered] Error 2


Simply leave out Phonon (the audio component) because it is not allowed with static linking mode. (This is a bug in the build system). You'd think they'd at least build all the configurations before release...

So, to build Qt 4.6 (2009.05) for a statically-linked application, cd to your qt directory (e.g. C:\Qt\2009.05\qt) and simply build it without phonon.
mingw32-make distclean
config -confclean
configure -static -no-phonon -no-phonon-backend
mingw32-make sub-src
This built the Qt system, and my app ran successfully after I built it in Qt Creator. Unfortunately, now the QLabel refuses to setPixmap(). My image labels don't show on the GUI. I'll be abandoning this train of thought soon, either by downgrading to 4.5.3 or by staying with the dynamically linked 4.6.

My system is a Dell Xeon E5540 quad-core 2.53GHZ. Windows XP. 12 Gigs RAM. 2TB RAID 5. Hoohoohaha.

No comments:

Post a Comment