[PyQt] Building PyQt on Windows; problems generating the C++ code

Boudewijn Rempt boud at valdyas.org
Wed Apr 5 12:17:35 BST 2017

I'm trying to build pyqt on windows. I've got Python in c:\python35,
I'm using sip 4.19.2, Qt 5.6.1 and PyQt 5.6.1. I'm using mingw-5.4,
and built Qt myself. Qt is in c:\dev\i.

Sip installs correctly:

c:\dev\d\sip-4.19.2\sip-4.19.2>c:\python36\python.exe configure.py --platform win32-g++
This is SIP 4.19.2 for Python 3.6.1 on win32.
The SIP code generator will be installed in c:\python36.
The sip module will be installed in c:\python36\Lib\site-packages.
The sip.pyi stub file will be installed in c:\python36\Lib\site-packages.
The sip.h header file will be installed in c:\python36\include.
The default directory to install .sip files in is c:\python36\sip.
Creating siplib\sip.h...
Creating siplib\siplib.c...
Creating siplib\siplib.sbf...
Creating sipconfig.py...
Creating top level Makefile...
Creating sip code generator Makefile...
Creating sip module Makefile...

c:\dev\d\sip-4.19.2\sip-4.19.2>mingw32-make install


copy /y c:\dev\d\sip-4.19.2\sip-4.19.2\sipdistutils.py c:\python36\Lib\site-packages\sipdistutils.py
        1 file(s) copied.

But running PyQt's configure fails:

c:\dev\d\PyQt5_gpl-5.6\PyQt5_gpl-5.6>python configure.py --spec win32-g++ --confirm-license --qmake c:\dev\i\bin\qmake.exe --verbose
Querying qmake about your Qt installation...
Determining the details of your Qt installation...
c:\dev\i\bin\qmake.exe -o qtdetail.mk qtdetail.pro
mingw32-make -f qtdetail.mk release
mingw32-make -f qtdetail.mk.Release
mingw32-make[1]: Entering directory 'c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I\dev\i\include -I\dev\i\include\QtCore -Irelease -I\dev\i\mkspecs\win32-g++  -o release\qtdetail.o qtdetail.cpp
g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\qtdetail.exe release/qtdetail.o  -lmingw32 -L\dev\i\lib \dev\i\lib\libqtmain.a -lshell32 \dev\i\lib\libQt5Core.a
mingw32-make[1]: Leaving directory 'c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6'
This is the GPL version of PyQt 5.6 (licensed under the GNU General Public
License) for Python 3.6.1 on win32.
Found the license file pyqt-gpl.sip.
Checking to see if the QtGui module should be built...
c:\dev\i\bin\qmake.exe -o cfgtest_QtGui.mk cfgtest_QtGui.pro
mingw32-make -f cfgtest_QtGui.mk release
mingw32-make -f cfgtest_QtGui.mk.Release
mingw32-make[1]: Entering directory 'c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6'
g++ -c -pipe -fno-keep-inline-dllexport -mstackrealign -O2 -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I\dev\i\include -I\dev\i\include\QtGui -I\dev\i\include\QtCore -Irelease -I\dev\i\mkspecs\win32-g++  -o release\cfgtest_QtGui.o cfgtest_QtGui.cpp
cfgtest_QtGui.cpp: In function 'int qMain(int, char**)':
cfgtest_QtGui.cpp:6:1: warning: no return statement in function returning non-void [-Wreturn-type]
g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\cfgtest_QtGui.exe release/cfgtest_QtGui.o  -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -L\dev\i\lib \dev\i\lib\libqtmain.a -lshell32 \dev\i\lib\libQt5Gui.a \dev\i\lib\libQt5Core.a


Qt v5.6.1 (Open Source) is being used.
The qmake executable is c:\dev\i\bin\qmake.exe.
Qt is built as a shared library.
SIP 4.19.2 is being used.
The sip executable is c:\python36\sip.exe.
These PyQt5 modules will be built: QtCore, QtGui, QtHelp, QtMultimedia,
QtMultimediaWidgets, QtNetwork, QtOpenGL, QtPrintSupport, QtQml, QtQuick,
QtSql, QtSvg, QtTest, QtWidgets, QtXml, _QOpenGLFunctions_2_0,
_QOpenGLFunctions_2_1, _QOpenGLFunctions_4_1_Core, QtWinExtras, QtQuickWidgets.
The PyQt5 Python package will be installed in c:\python36\Lib\site-packages.
PyQt5 is being built with generated docstrings.
The Designer plugin will be installed in /dev/i/plugins/designer.
The qmlscene plugin will be installed in /dev/i/plugins/PyQt5.
The PyQt5 PEP 484 stub files will be installed in
The PyQt5 .sip files will be installed in c:\python36\sip\PyQt5.
pyuic5, pyrcc5 and pylupdate5 will be installed in c:\python36.
The interpreter used by pyuic5 is c:\python36\python.exe.
Generating the C++ source for the QtCore module...
c:\python36\sip.exe -w -f -t WS_WIN -t Qt_5_6_1 -x PyQt_SSL -B Qt_6_0_0 -o -y QtCore.pyi -c c:\dev\d\PyQt5_gpl-5.6\PyQt5_gpl-5.6\QtCore -I sip -I c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6/sip c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6/sip/QtCore/QtCoremod.sip
sip: Deprecation warning: c:/dev/d/PyQt5_gpl-5.6/PyQt5_gpl-5.6/sip/QtCore/QtCoremod.sip:23: %Module version numbers are deprecated and ignored
Error: Unable to create the C++ code.

I notice that unlike the Linux configure.py run, there seems to be no "generating pro files" set. Apart from that, not even in verbose mode, I can figure out why this error happens.

Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org

More information about the PyQt mailing list