[PyQt] Building PyQt on Windows

Phil Thompson phil at riverbankcomputing.com
Fri Sep 18 17:41:05 BST 2009


On Fri, 18 Sep 2009 17:19:01 +0100 (BST), Jeremy Sanders
<jeremy at jeremysanders.net> wrote:
> What's the recommended compiler to use to compile Qt and PyQt on Windows?
> 
> The free edition of Qt-4.5.2 builds very cleanly with mingw. I did a 
> static build of Qt with mingw (gcc 3.4.5) on Windows XP.
> 
> I downloaded the Python 2.6.2 binary from the Python website and built
the 
> latest sip snapshot using the win32-g++ platform. That appears to build 
> okay.
> 
> I then tried the latest PyQt snapshot but it failed:
> 
> g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE
> -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
> -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\4.5.2\include\QtCore"
> -I"..\..\..\..\Qt\4.5.2\include\QtGui" -I"..\..\..\..\Qt\4.5.2\include"
> -I"..\..\..\..\Python26\include" -I"..\..\_qt" -I"."
> -I"..\..\..\..\Qt\4.5.2\include\ActiveQt" -I"release"
> -I"..\..\..\..\Qt\4.5.2\mkspecs\default" -o release\qpycore_qstring.o
> qpycore_qstring.cpp
> qpycore_qstring.cpp: In function `QString
> qpycore_PyObject_AsQString(PyObject*)':
> qpycore_qstring.cpp:100: error: invalid conversion from `Py_UNICODE*' to
> `const ushort*'
> qpycore_qstring.cpp:100: error:   initializing argument 1 of `static
> QString QString::fromUtf16(const ushort*, int)'
> 
> This is with PyQt configured using:
> configure.py --consolidate -c -j 5 --enable QtCore --enable QtSvg
--plugin
> qjpeg --plugin qtiff --pluginqgif --plugin qsvgicon
> 
> Is this a supported configuration? Would it be best to try to build
Python 
> with mingw or rebuild Qt and PyQt with Visual Studio Express?

My recommendation is to use the compiler used to compile Python which for
Python v2.6 is MSVC 2008. I don't test with MinGW.

That said, I suspect the fix to the above is just to explicitly cast to
const ushort *. If that works then tell me.

Phil


More information about the PyQt mailing list