[PyQt] Building PyQt on Windows

Jeremy Sanders jeremy at jeremysanders.net
Fri Sep 18 18:02:26 BST 2009


On Fri, 18 Sep 2009, Phil Thompson wrote:

> 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.

I should have tried that myself. That works fine.

I now have a linker error for the SVG plugin for some reason. I had to add 
-lQtSvg in the link command line. I thought I had configured PyQt for SVG.

The demos seem to work fine, thanks!

Jeremy

-- 
Jeremy Sanders <jeremy at jeremysanders.net>
http://www.jeremysanders.net/                Cambridge, UK
Public Key Server PGP Key ID: E1AAE053


More information about the PyQt mailing list